mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-23 09:19:51 +00:00
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>
This commit is contained in:
parent
4365a5676f
commit
f065f41f48
1 changed files with 1 additions and 1 deletions
|
@ -89,7 +89,7 @@ int timecompare_offset(struct timecompare *sync,
|
|||
* source time
|
||||
*/
|
||||
sample.offset =
|
||||
ktime_to_ns(ktime_add(end, start)) / 2 -
|
||||
(ktime_to_ns(end) + ktime_to_ns(start)) / 2 -
|
||||
ts;
|
||||
|
||||
/* simple insertion sort based on duration */
|
||||
|
|
Loading…
Reference in a new issue