Skip to content

Commit 4a7ca88

Browse files
paulmckrcuAvenger-285714
authored andcommitted
clocksource: Fix brown-bag boolean thinko in cs_watchdog_read()
[ Upstream commit f2655ac2c06a15558e51ed6529de280e1553c86e ] The current "nretries > 1 || nretries >= max_retries" check in cs_watchdog_read() will always evaluate to true, and thus pr_warn(), if nretries is greater than 1. The intent is instead to never warn on the first try, but otherwise warn if the successful retry was the last retry. Therefore, change that "||" to "&&". Fixes: db3a34e ("clocksource: Retry clock read if long delays detected") Reported-by: Borislav Petkov <[email protected]> Signed-off-by: Paul E. McKenney <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/all/[email protected] Signed-off-by: Sasha Levin <[email protected]>
1 parent 3faf90a commit 4a7ca88

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kernel/time/clocksource.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ static enum wd_read_status cs_watchdog_read(struct clocksource *cs, u64 *csnow,
238238
wd_delay = clocksource_cyc2ns(wd_delta, watchdog->mult,
239239
watchdog->shift);
240240
if (wd_delay <= WATCHDOG_MAX_SKEW) {
241-
if (nretries > 1 || nretries >= max_retries) {
241+
if (nretries > 1 && nretries >= max_retries) {
242242
pr_warn("timekeeping watchdog on CPU%d: %s retried %d times before success\n",
243243
smp_processor_id(), watchdog->name, nretries);
244244
}

0 commit comments

Comments
 (0)