time: Avoid potential shift overflow with large shift values
authorJohn Stultz <[email protected]>
Wed, 22 Aug 2012 00:30:48 +0000 (20:30 -0400)
committerThomas Gleixner <[email protected]>
Wed, 22 Aug 2012 08:42:13 +0000 (10:42 +0200)
commit6ea565a9be32a3c8d1092017686f183b6d8c4514
tree2db67e9659f91f11997998ba9845f4c7cb0d89ab
parent85dc8f05c93c8105987de9d7e7cebf15a72ff4ec
time: Avoid potential shift overflow with large shift values

Andreas Schwab noticed that the 1 << tk->shift could overflow if the
shift value was greater than 30, since 1 would be a 32bit long on
32bit architectures. This issue was introduced by 1e75fa8be (time:
Condense timekeeper.xtime into xtime_sec)

Use 1ULL instead to ensure we don't overflow on the shift.

Reported-by: Andreas Schwab <[email protected]>
Signed-off-by: John Stultz <[email protected]>
Cc: Prarit Bhargava <[email protected]>
Cc: Ingo Molnar <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Thomas Gleixner <[email protected]>
kernel/time/timekeeping.c