Skip to content

Commit 3d2e83a

Browse files
Frederic WeisbeckerKAGA-KOKO
authored andcommitted
timers: Preserve higher bits of expiration on index calculation
The higher bits of the timer expiration are cropped while calling calc_index() due to the implicit cast from unsigned long to unsigned int. This loss shouldn't have consequences on the current code since all the computation to calculate the index is done on the lower 32 bits. However to prepare for returning the actual bucket expiration from calc_index() in order to properly fix base->next_expiry updates, the higher bits need to be preserved. Signed-off-by: Frederic Weisbecker <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent e2a71bd commit 3d2e83a

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
@@ -487,7 +487,7 @@ static inline void timer_set_idx(struct timer_list *timer, unsigned int idx)
487487
* Helper function to calculate the array index for a given expiry
488488
* time.
489489
*/
490-
static inline unsigned calc_index(unsigned expires, unsigned lvl)
490+
static inline unsigned calc_index(unsigned long expires, unsigned lvl)
491491
{
492492
expires = (expires + LVL_GRAN(lvl)) >> LVL_SHIFT(lvl);
493493
return LVL_OFFS(lvl) + (expires & LVL_MASK);

0 commit comments

Comments
 (0)