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")
MFC after: 3 days
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user