Skip to content

Commit

Permalink
ntp/y2038: Remove incorrect time_t truncation
Browse files Browse the repository at this point in the history
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: ead2541 ("timex: use __kernel_timex internally")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: stable@vger.kernel.org
Link: https://lkml.kernel.org/r/20191108203435.112759-2-arnd@arndb.de
  • Loading branch information
Arnd Bergmann authored and Thomas Gleixner committed Nov 12, 2019
1 parent 31f4f5b commit 2f58413
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kernel/time/ntp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 2f58413

Please sign in to comment.