Skip to content

Commit 9ef8b23

Browse files
matijaGPgregkh
authored andcommitted
timers: Fix overflow in get_next_timer_interrupt
commit 34f41c0 upstream. For e.g. HZ=100, timer being 430 jiffies in the future, and 32 bit unsigned int, there is an overflow on unsigned int right-hand side of the expression which results with wrong values being returned. Type cast the multiplier to 64bit to avoid that issue. Fixes: 46c8f0b ("timers: Fix get_next_timer_interrupt() computation") Signed-off-by: Matija Glavinic Pecotic <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Reviewed-by: Alexander Sverdlin <[email protected]> Cc: [email protected] Cc: [email protected] Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 7b95b74 commit 9ef8b23

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kernel/time/timer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1536,7 +1536,7 @@ u64 get_next_timer_interrupt(unsigned long basej, u64 basem)
15361536
base->is_idle = false;
15371537
} else {
15381538
if (!is_max_delta)
1539-
expires = basem + (nextevt - basej) * TICK_NSEC;
1539+
expires = basem + (u64)(nextevt - basej) * TICK_NSEC;
15401540
/*
15411541
* If we expect to sleep more than a tick, mark the base idle:
15421542
*/

0 commit comments

Comments
 (0)