History

clocksource: Fix abs() usage w/ 64bit values

This patch fixes one cases where abs() was being used with 64-bit nanosecond values, where the result may be capped at 32-bits. This potentially could cause watchdog false negatives on 32-bit systems, so this patch addresses the issue by using abs64().

John Stultz committed 11 years ago

Commit 67dfae01 parent bdf73441 file · +1 −1Browse files

Unified · Split

kernel/time/clocksource.c+1−1
@@ -217,7 +217,7 @@ static void clocksource_watchdog(unsigned long data) · 216 unmodified lines
217217 continue;
218218
219219 /* Check the deviation from the watchdog clocksource. */
220− if ((abs(cs_nsec - wd_nsec) > WATCHDOG_THRESHOLD)) {
220+ if (abs64(cs_nsec - wd_nsec) > WATCHDOG_THRESHOLD) {
221221 pr_warn("timekeeping watchdog: Marking clocksource '%s' as unstable because the skew is too large:\n",
222222 cs->name);
223223 pr_warn(" '%s' wd_now: %llx wd_last: %llx mask: %llx\n",