aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Hibbits <jhibbits@FreeBSD.org>2026-06-10 13:50:14 +0000
committerMark Johnston <markj@FreeBSD.org>2026-11-09 15:02:29 +0000
commit3e2a209fbc6b0d25e7f685adfd0e9cbed5161097 (patch)
treee4848902423e4bac6a8a3367805e5d3578a2b281
parent95719d8a895bf8170851e9844d9b4092b1d2b6fe (diff)
watchdog: Fix a couple type issues
* Force the type of the literal `1` passed to nstosbt() to ensure it's a 64-bit type (or larger). Otherwise it gets inconveniently typed to int, resulting in truncation. * Use `flsll()` when converting sbt to power-of-2-nanoseconds to fix 32-bit compatibility. Approved by: so Security: FreeBSD-EN-26:28.watchdog PR: 292616 Obtained from: Hewlett Packard Enterprise Fixes: 26d6617f3 ("watchdog: Convert to using sbintime_t format") (cherry picked from commit d08cb1dc17486920c1506f175d77259e0ac3f3a3) (cherry picked from commit ced89d9c04d450c1dad7fe5f21c1b2afca306046)
-rw-r--r--sys/dev/watchdog/watchdog.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/dev/watchdog/watchdog.c b/sys/dev/watchdog/watchdog.c
index e1b2e08c3f10..7f0b457b89d1 100644
--- a/sys/dev/watchdog/watchdog.c
+++ b/sys/dev/watchdog/watchdog.c
@@ -110,7 +110,7 @@ wdog_kern_pat(u_int utim)
if (utim == WD_TO_NEVER)
sbt = 0;
else
- sbt = nstosbt(1 << utim);
+ sbt = nstosbt(1ULL << utim);
return (wdog_kern_pat_sbt(sbt));
}
@@ -142,7 +142,7 @@ wdog_kern_pat_sbt(sbintime_t sbt)
/* legacy uses power-of-2-nanoseconds time. */
if (sbt != 0) {
- pow2ns = flsl(sbttons(sbt));
+ pow2ns = flsll(sbttons(sbt));
}
if (wd_last_sbt != sbt) {
wd_last_u = pow2ns;