diff options
author | Colin Cross <ccross@android.com> | 2014-02-10 13:16:29 -0800 |
---|---|---|
committer | Simon Shields <keepcalm444@gmail.com> | 2016-02-20 13:25:02 +1100 |
commit | 974a591f891c0c7fb45a26edad8d8571e1337cee (patch) | |
tree | cbadc2587f2ff81dc7bc5fc1f70eaad6c0f36f5e /kernel | |
parent | d4709cc8d054379346d263a1ca69484ac63287a6 (diff) | |
download | kernel_samsung_smdk4412-974a591f891c0c7fb45a26edad8d8571e1337cee.tar.gz kernel_samsung_smdk4412-974a591f891c0c7fb45a26edad8d8571e1337cee.tar.bz2 kernel_samsung_smdk4412-974a591f891c0c7fb45a26edad8d8571e1337cee.zip |
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>
Change-Id: If4ec90946bb49b022403c14e63903b3027dd5c58
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/time/timekeeping.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index e1889779bc9..7aa8c3d89ac 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -1059,7 +1059,7 @@ void get_monotonic_boottime(struct timespec *ts) } while (read_seqretry(&xtime_lock, seq)); set_normalized_timespec(ts, ts->tv_sec + tomono.tv_sec + sleep.tv_sec, - ts->tv_nsec + tomono.tv_nsec + sleep.tv_nsec + nsecs); + (s64)ts->tv_nsec + tomono.tv_nsec + sleep.tv_nsec + nsecs); } EXPORT_SYMBOL_GPL(get_monotonic_boottime); |