[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1416890145-30048-1-git-send-email-john.stultz@linaro.org>
Date: Mon, 24 Nov 2014 20:35:45 -0800
From: John Stultz <john.stultz@...aro.org>
To: lkml <linux-kernel@...r.kernel.org>
Cc: John Stultz <john.stultz@...aro.org>,
"pang.xunlei" <pang.xunlei@...aro.org>,
Fengguang Wu <fengguang.wu@...el.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...nel.org>
Subject: [PATCH] time: Fix sign bug in ntp mult overflow warning
In commit 6067dc5a8c2b ("time: Avoid possible NTP adjustment mult
overflow") a new check was added to watch for adjustments that could
cause a mult overflow.
Unfortunately the check compares a signed with unsigned value and
ignored the case where the adjustment was negative, which causes
spurious warn-ons on some systems (and seems like it would result in
problematic time adjustments there as well, due to the early
return).
Thus this patch adds a check to make sure the adjustment is positive
before we check for an overflow, and resovles the issue in my
testing.
Cc: pang.xunlei <pang.xunlei@...aro.org>
Cc: Fengguang Wu <fengguang.wu@...el.com>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: Ingo Molnar <mingo@...nel.org>
Reported-by: Fengguang Wu <fengguang.wu@...el.com>
Debugged-by: pang.xunlei <pang.xunlei@...aro.org>
Signed-off-by: John Stultz <john.stultz@...aro.org>
---
kernel/time/timekeeping.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index 29a7d67..2dc0646 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -1330,7 +1330,7 @@ static __always_inline void timekeeping_apply_adjustment(struct timekeeper *tk,
*
* XXX - TODO: Doc ntp_error calculation.
*/
- if (tk->tkr.mult + mult_adj < mult_adj) {
+ if ((mult_adj > 0) && (tk->tkr.mult + mult_adj < mult_adj)) {
/* NTP adjustment caused clocksource mult overflow */
WARN_ON_ONCE(1);
return;
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists