timekeeping: fix 32-bit overflow in get_monotonic_boottime
authorColin Cross <ccross@android.com>
Mon, 10 Feb 2014 21:16:29 +0000 (13:16 -0800)
committerBen Hutchings <ben@decadent.org.uk>
Tue, 1 Apr 2014 23:59:00 +0000 (00:59 +0100)
commit7f4d7e8fe42d3a34994055355694236f489c874f
tree7bd3e4e5d4582b23640d0631765332d68d2e1fac
parent5162fef0ca711d3d467b6cf181219e43100d7122
timekeeping: fix 32-bit overflow in get_monotonic_boottime

fixed upstream in v3.6 by ec145babe754f9ea1079034a108104b6001e001c

get_monotonic_boottime adds three nanonsecond values stored
in longs, followed by an s64.  If the long values are all
close to 1e9 the first three additions can overflow and
become negative when added to the s64.  Cast the first
value to s64 so that all additions are 64 bit.

Signed-off-by: Colin Cross <ccross@android.com>
[jstultz: Fished this out of the AOSP commong.git tree. This was
fixed upstream in v3.6 by ec145babe754f9ea1079034a108104b6001e001c]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
kernel/time/timekeeping.c