Skip to content

Commit

Permalink
time: Fix casting issue in timekeeping_forward_now
Browse files Browse the repository at this point in the history
arch_gettimeoffset returns a u32 value which when shifted by tk->shift
can overflow. This issue was introduced with 1e75fa8 (time: Condense
timekeeper.xtime into xtime_sec)

Cast it to u64 first.

Signed-off-by: Andreas Schwab <schwab@linux-m68k.org>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Cc: Prarit Bhargava <prarit@redhat.com>
Cc: Ingo Molnar <mingo@kernel.org>
Link: http://lkml.kernel.org/r/1345595449-34965-3-git-send-email-john.stultz@linaro.org
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
  • Loading branch information
Andreas Schwab authored and Thomas Gleixner committed Aug 22, 2012
1 parent 784ffcb commit 85dc8f0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kernel/time/timekeeping.c
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ static void timekeeping_forward_now(struct timekeeper *tk)
tk->xtime_nsec += cycle_delta * tk->mult;

/* If arch requires, add in gettimeoffset() */
tk->xtime_nsec += arch_gettimeoffset() << tk->shift;
tk->xtime_nsec += (u64)arch_gettimeoffset() << tk->shift;

tk_normalize_xtime(tk);

Expand Down

0 comments on commit 85dc8f0

Please sign in to comment.