time: Fix casting issue in timekeeping_forward_now
authorAndreas Schwab <schwab@linux-m68k.org>
Wed, 22 Aug 2012 00:30:47 +0000 (20:30 -0400)
committerThomas Gleixner <tglx@linutronix.de>
Wed, 22 Aug 2012 08:42:13 +0000 (10:42 +0200)
arch_gettimeoffset returns a u32 value which when shifted by tk->shift
can overflow. This issue was introduced with 1e75fa8be (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>
kernel/time/timekeeping.c

index 258164ae45ccb75651173134e0f3c1c85ca88264..1dbf80ec7696467c2260296fec31262e2a3c50d7 100644 (file)
@@ -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);