diff options
author | Barry Song <21cnbao@gmail.com> | 2009-12-15 19:45:34 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-16 10:19:57 -0500 |
commit | f065f41f48569122b5bcddbd1ba2354f7cc29fdc (patch) | |
tree | 68606305bfb3aba16437017e0596ccae11e6f6db | |
parent | 4365a5676fa3aa1d5ae6c90c22a0044f09ba584e (diff) |
timecompare: fix half-Y2K38 problem in timecompare_update while calculating offset
ktime will overflow from 03:14:07 UTC on Tuesday, 19 January 2038,
ktime_add() in timecompare_update() will overflow a half earlier. As a
result, wrong offset will be gotten, then cause some strange problems.
Signed-off-by: Barry Song <21cnbao@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Patrick Ohly <patrick.ohly@intel.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: John Stultz <johnstul@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | kernel/time/timecompare.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/time/timecompare.c b/kernel/time/timecompare.c index 96ff643a5a59..12f5c55090be 100644 --- a/kernel/time/timecompare.c +++ b/kernel/time/timecompare.c | |||
@@ -89,7 +89,7 @@ int timecompare_offset(struct timecompare *sync, | |||
89 | * source time | 89 | * source time |
90 | */ | 90 | */ |
91 | sample.offset = | 91 | sample.offset = |
92 | ktime_to_ns(ktime_add(end, start)) / 2 - | 92 | (ktime_to_ns(end) + ktime_to_ns(start)) / 2 - |
93 | ts; | 93 | ts; |
94 | 94 | ||
95 | /* simple insertion sort based on duration */ | 95 | /* simple insertion sort based on duration */ |