--- ./fs/eventpoll.c.bad 2005-12-04 18:05:26.000000000 +0100 +++ ./fs/eventpoll.c 2005-12-04 21:00:02.000000000 +0100 @@ -1571,12 +1571,12 @@ wait_queue_t wait; /* - * Calculate the timeout by checking for the "infinite" value ( -1 ) - * and the overflow condition. The passed timeout is in milliseconds, - * that why (t * HZ) / 1000. + * Calculate the timeout by checking for the "infinite" value ( < 0 ) + * and the overflow condition. The passed timeout is in milliseconds. */ - jtimeout = timeout == -1 || timeout > (MAX_SCHEDULE_TIMEOUT - 1000) / HZ ? - MAX_SCHEDULE_TIMEOUT: (timeout * HZ + 999) / 1000; + if (unlikely(timeout < 0 || + (jtimeout = msec_to_jiffies(timeout)) >= MAX_JIFFY_OFFSET)) + jtimeout = MAX_SCHEDULE_TIMEOUT; retry: write_lock_irqsave(&ep->lock, flags);