
From: "Bill Rugolsky Jr." <brugolsky@telemetry-investments.com>

This patch cause select() to return EINVAL when passed an un-normalized
timeval usec, and fixes up the range check in preparation for the patch
that follows.



---

 25-akpm/fs/select.c |    4 +---
 1 files changed, 1 insertion(+), 3 deletions(-)

diff -puN fs/select.c~poll-select-range-check-fix fs/select.c
--- 25/fs/select.c~poll-select-range-check-fix	2004-03-12 01:30:21.000000000 -0800
+++ 25-akpm/fs/select.c	2004-03-12 01:30:21.000000000 -0800
@@ -291,8 +291,6 @@ static void select_bits_free(void *bits,
  * Update: ERESTARTSYS breaks at least the xview clock binary, so
  * I'm trying ERESTARTNOHAND which restart only when you want to.
  */
-#define MAX_SELECT_SECONDS \
-	((unsigned long) (MAX_SCHEDULE_TIMEOUT / HZ)-1)
 
 asmlinkage long
 sys_select(int n, fd_set __user *inp, fd_set __user *outp, fd_set __user *exp, struct timeval __user *tvp)
@@ -315,7 +313,7 @@ sys_select(int n, fd_set __user *inp, fd
 		if (sec < 0 || usec < 0)
 			goto out_nofds;
 
-		if ((unsigned long) sec < MAX_SELECT_SECONDS) {
+		if ((unsigned long) sec < (MAX_SCHEDULE_TIMEOUT-1) / HZ - 1) {
 			timeout = ROUND_UP(usec, 1000000/HZ);
 			timeout += sec * (unsigned long) HZ;
 		}

_
