summaryrefslogtreecommitdiff
path: root/tools/lib/python/feat/parse_features.py
diff options
context:
space:
mode:
authorSander Vanheule <sander@svanheule.net>2026-05-16 00:23:50 +0300
committerGuenter Roeck <linux@roeck-us.net>2026-05-16 20:36:34 +0300
commit05d871c5194bef01b525ca9289efb736bbfd6ece (patch)
tree959ef650000fc782eaea82f0ffd7d8524a1da183 /tools/lib/python/feat/parse_features.py
parentf83da91c7e038c8753c44a85dc9fe2fcf68db17a (diff)
downloadlinux-05d871c5194bef01b525ca9289efb736bbfd6ece.tar.xz
watchdog: realtek-otto: prevent PHASE2 underflows
For small pretimeout values, ((timeout - pretimeout) / tick) might be rounded up to the same value as (timeout / tick). As a result, the number of PHASE2 ticks may be zero, causing an underflow when subtracting 1 to configure the hardware. While this results in a longer-than-expected time to system reset, the duration of PHASE1 and minimum ping interval for the watchdog would still be correct. As the watchdog core ensures pretimeout is strictly less than timeout, ceil(timeout / tick) is strictly greater than floor(pretimeout / tick) and the number of PHASE1 ticks cannot be 0. So instead of rounding up the number of PHASE1 ticks, we can round down the number of PHASE2 ticks, maintaining the current behavior while avoiding underflows. The original helper function is now inlined, as it doesn't save any duplication anymore. Signed-off-by: Sander Vanheule <sander@svanheule.net> Link: https://lore.kernel.org/r/20260515212351.752054-2-sander@svanheule.net Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'tools/lib/python/feat/parse_features.py')
0 files changed, 0 insertions, 0 deletions