From 94d27bc0331d2595f9fd98c9477507806f4dd0d0 Mon Sep 17 00:00:00 2001 From: Grant Slater Date: Fri, 16 Jan 2026 14:38:48 +0000 Subject: T8187: fix watchdog timeout validation if kernel min/max timeout are zero --- src/conf_mode/system_watchdog.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/conf_mode/system_watchdog.py b/src/conf_mode/system_watchdog.py index 059e74dd9..8c050f333 100755 --- a/src/conf_mode/system_watchdog.py +++ b/src/conf_mode/system_watchdog.py @@ -63,7 +63,7 @@ def _read_sysfs_int(path: Path) -> Optional[int]: def _get_watchdog_timeout_limits() -> tuple[int, int]: """Return (min_timeout, max_timeout) from sysfs if available. - If sysfs is unavailable (device not present/loaded yet), fall back to a + If sysfs is unavailable (device not present/loaded yet) or zero, fall back to a conservative common kernel max of 65535 seconds. """ @@ -74,10 +74,8 @@ def _get_watchdog_timeout_limits() -> tuple[int, int]: max_timeout = _read_sysfs_int(WATCHDOG_SYSFS / 'max_timeout') # Some drivers may not expose min/max. Fall back to sane defaults. - if min_timeout is None: - min_timeout = 1 - if max_timeout is None: - max_timeout = 65535 + min_timeout = min_timeout if min_timeout and min_timeout > 0 else 1 + max_timeout = max_timeout if max_timeout and max_timeout > 0 else 65535 return min_timeout, max_timeout -- cgit v1.2.3