+ timecompare-fix-half-y2k38-problem-in-timecompare_update-while-calculating-offset.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     timecompare: fix half-Y2K38 problem in timecompare_update while calculating offset
has been added to the -mm tree.  Its filename is
     timecompare-fix-half-y2k38-problem-in-timecompare_update-while-calculating-offset.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/SubmitChecklist when testing your code ***

See http://userweb.kernel.org/~akpm/stuff/added-to-mm.txt to find
out what to do about this

The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/

------------------------------------------------------
Subject: timecompare: fix half-Y2K38 problem in timecompare_update while calculating offset
From: Barry Song <21cnbao@xxxxxxxxx>

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.

Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxx>
Cc: Patrick Ohly <patrick.ohly@xxxxxxxxx>
Cc: David S. Miller <davem@xxxxxxxxxxxxx>
Cc: John Stultz <johnstul@xxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 kernel/time/timecompare.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -puN kernel/time/timecompare.c~timecompare-fix-half-y2k38-problem-in-timecompare_update-while-calculating-offset kernel/time/timecompare.c
--- a/kernel/time/timecompare.c~timecompare-fix-half-y2k38-problem-in-timecompare_update-while-calculating-offset
+++ a/kernel/time/timecompare.c
@@ -89,7 +89,7 @@ int timecompare_offset(struct timecompar
 			 * 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 */
_

Patches currently in -mm which might be from 21cnbao@xxxxxxxxx are

timecompare-fix-half-y2k38-problem-in-timecompare_update-while-calculating-offset.patch

--
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux