Skip to content

Commit 025929f

Browse files
committed
Merge tag 'timers_urgent_for_v5.11_rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull timer fixes from Borislav Petkov: - Fix an integer overflow in the NTP RTC synchronization which led to the latter happening every 2 seconds instead of the intended every 11 minutes. - Get rid of now unused get_seconds(). * tag 'timers_urgent_for_v5.11_rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: ntp: Fix RTC synchronization on 32-bit platforms timekeeping: Remove unused get_seconds()
2 parents 17b6c49 + e3fab2f commit 025929f

File tree

4 files changed

+3
-19
lines changed

4 files changed

+3
-19
lines changed

include/linux/ktime.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,5 @@ static inline ktime_t ms_to_ktime(u64 ms)
230230
}
231231

232232
# include <linux/timekeeping.h>
233-
# include <linux/timekeeping32.h>
234233

235234
#endif

include/linux/timekeeping32.h

Lines changed: 0 additions & 14 deletions
This file was deleted.

kernel/time/ntp.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ int second_overflow(time64_t secs)
498498
static void sync_hw_clock(struct work_struct *work);
499499
static DECLARE_WORK(sync_work, sync_hw_clock);
500500
static struct hrtimer sync_hrtimer;
501-
#define SYNC_PERIOD_NS (11UL * 60 * NSEC_PER_SEC)
501+
#define SYNC_PERIOD_NS (11ULL * 60 * NSEC_PER_SEC)
502502

503503
static enum hrtimer_restart sync_timer_callback(struct hrtimer *timer)
504504
{
@@ -512,7 +512,7 @@ static void sched_sync_hw_clock(unsigned long offset_nsec, bool retry)
512512
ktime_t exp = ktime_set(ktime_get_real_seconds(), 0);
513513

514514
if (retry)
515-
exp = ktime_add_ns(exp, 2 * NSEC_PER_SEC - offset_nsec);
515+
exp = ktime_add_ns(exp, 2ULL * NSEC_PER_SEC - offset_nsec);
516516
else
517517
exp = ktime_add_ns(exp, SYNC_PERIOD_NS - offset_nsec);
518518

kernel/time/timekeeping.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -991,8 +991,7 @@ EXPORT_SYMBOL_GPL(ktime_get_seconds);
991991
/**
992992
* ktime_get_real_seconds - Get the seconds portion of CLOCK_REALTIME
993993
*
994-
* Returns the wall clock seconds since 1970. This replaces the
995-
* get_seconds() interface which is not y2038 safe on 32bit systems.
994+
* Returns the wall clock seconds since 1970.
996995
*
997996
* For 64bit systems the fast access to tk->xtime_sec is preserved. On
998997
* 32bit systems the access must be protected with the sequence

0 commit comments

Comments
 (0)