From: Arnd Bergmann Date: Fri, 8 Nov 2019 20:34:24 +0000 (+0100) Subject: ntp/y2038: Remove incorrect time_t truncation X-Git-Tag: Ubuntu-5.3.0-25.27~79 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=e0acd4e68c5431dd8e7b78913bb6231a0538d1a6;p=mirror_ubuntu-eoan-kernel.git ntp/y2038: Remove incorrect time_t truncation BugLink: https://bugs.launchpad.net/bugs/1853475 commit 2f5841349df281ecf8f81cc82d869b8476f0db0b upstream. A cast to 'time_t' was accidentally left in place during the conversion of __do_adjtimex() to 64-bit timestamps, so the resulting value is incorrectly truncated. Remove the cast so the 64-bit time gets propagated correctly. Fixes: ead25417f82e ("timex: use __kernel_timex internally") Signed-off-by: Arnd Bergmann Signed-off-by: Thomas Gleixner Cc: stable@vger.kernel.org Link: https://lkml.kernel.org/r/20191108203435.112759-2-arnd@arndb.de Signed-off-by: Greg Kroah-Hartman Signed-off-by: Connor Kuehl Signed-off-by: Stefan Bader --- diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c index 65eb796610dc..069ca78fb0bf 100644 --- a/kernel/time/ntp.c +++ b/kernel/time/ntp.c @@ -771,7 +771,7 @@ int __do_adjtimex(struct __kernel_timex *txc, const struct timespec64 *ts, /* fill PPS status fields */ pps_fill_timex(txc); - txc->time.tv_sec = (time_t)ts->tv_sec; + txc->time.tv_sec = ts->tv_sec; txc->time.tv_usec = ts->tv_nsec; if (!(time_status & STA_NANO)) txc->time.tv_usec = ts->tv_nsec / NSEC_PER_USEC;