Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 Jul 2026 20:23:29 +0000
From:      Justin Hibbits <jhibbits@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: ced89d9c04d4 - stable/15 - watchdog: Fix a couple type issues
Message-ID:  <6a5fd541.22e2c.13658a74@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch stable/15 has been updated by jhibbits:

URL: https://cgit.FreeBSD.org/src/commit/?id=ced89d9c04d450c1dad7fe5f21c1b2afca306046

commit ced89d9c04d450c1dad7fe5f21c1b2afca306046
Author:     Justin Hibbits <jhibbits@FreeBSD.org>
AuthorDate: 2026-06-10 13:50:14 +0000
Commit:     Justin Hibbits <jhibbits@FreeBSD.org>
CommitDate: 2026-07-21 20:23:00 +0000

    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.
    
    PR:             292616
    Obtained from:  Hewlett Packard Enterprise
    Fixes:  26d6617f3 ("watchdog: Convert to using sbintime_t format")
    
    (cherry picked from commit d08cb1dc17486920c1506f175d77259e0ac3f3a3)
---
 sys/dev/watchdog/watchdog.c | 4 ++--
 1 file 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;


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6a5fd541.22e2c.13658a74>