[PATCH] Fix multiple conversion bugs in msecs_to_jiffies
authorIngo Molnar <mingo@elte.hu>
Fri, 16 Feb 2007 09:27:28 +0000 (01:27 -0800)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Fri, 16 Feb 2007 16:13:56 +0000 (08:13 -0800)
commit41cf54455da5e5dc847a9733d49ca23b5e7dd59e
treeea7aa5fe473f4716e4190f7a90a7663535fee312
parent8b9365d753d9870bb6451504c13570b81923228f
[PATCH] Fix multiple conversion bugs in msecs_to_jiffies

Fix multiple conversion bugs in msecs_to_jiffies().

The main problem is that this condition:

if (m > jiffies_to_msecs(MAX_JIFFY_OFFSET))

overflows if HZ is smaller than 1000!

This change is user-visible: for HZ=250 SUS-compliant poll()-timeout
value of -20 is mistakenly converted to 'immediate timeout'.

(The new dyntick code also triggered this, that's how we noticed.)

Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: john stultz <johnstul@us.ibm.com>
Cc: Roman Zippel <zippel@linux-m68k.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
kernel/time.c