summaryrefslogtreecommitdiff
path: root/kernel/time/timekeeping.c
diff options
context:
space:
mode:
authorAjay Nandakumar <anandakumarm@nvidia.com>2013-01-29 17:16:47 +0530
committerRiham Haidar <rhaidar@nvidia.com>2013-01-30 15:17:04 -0800
commit0179fea9f318b960660c3a2fecdf29fefe7c13e8 (patch)
tree08086aa6a68ba3327111efeea989655c120edf07 /kernel/time/timekeeping.c
parent9852cf7ca98bf62abb1d5c1070f482c598a15a5b (diff)
timekeeping: Fix time moving backwards
Changed the calculation logic that sometimes calculates the time wrong. Sometimes there is an overflow when the tv_nsec field in the timespec structure is being added since it is 32-bit. To resolve this issue nsec variable is being added first so that the addition is performed in 64 bit signed format. Bug 1217429 Change-Id: I9c65da88f02596ba73c47be6342ed909e650db22 Signed-off-by: Ajay Nandakumar <anandakumarm@nvidia.com> Reviewed-on: http://git-master/r/195092 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Prashant Gaikwad <pgaikwad@nvidia.com> Reviewed-by: Shridhar Rasal <srasal@nvidia.com> Reviewed-by: Bo Yan <byan@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com> Tested-by: Shridhar Rasal <srasal@nvidia.com>
Diffstat (limited to 'kernel/time/timekeeping.c')
-rw-r--r--kernel/time/timekeeping.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index f3a4dd993ca0..da680a659f72 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -1168,7 +1168,7 @@ void get_monotonic_boottime(struct timespec *ts)
} while (read_seqretry(&timekeeper.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);
+ nsecs + ts->tv_nsec + tomono.tv_nsec + sleep.tv_nsec);
}
EXPORT_SYMBOL_GPL(get_monotonic_boottime);