summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'kernel')
-rw-r--r--kernel/time/ntp.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c
index f447787a7394..02d96c007673 100644
--- a/kernel/time/ntp.c
+++ b/kernel/time/ntp.c
@@ -685,11 +685,10 @@ static inline void process_adjtimex_modes(const struct __kernel_timex *txc,
time_esterror = clamp(txc->esterror, (long long)0, (long long)NTP_PHASE_LIMIT);
if (txc->modes & ADJ_TIMECONST) {
- time_constant = txc->constant;
+ time_constant = clamp(txc->constant, (long long)0, (long long)MAXTC);
if (!(time_status & STA_NANO))
time_constant += 4;
- time_constant = min(time_constant, (long)MAXTC);
- time_constant = max(time_constant, 0l);
+ time_constant = clamp(time_constant, (long)0, (long)MAXTC);
}
if (txc->modes & ADJ_TAI &&