sched/wdog: Fix wd_start() boundary check for WDOG_MAX_DELAY

The current implementation allows the delay passed to wd_start() to be
   equal to WDOG_MAX_DELAY. However, since clock_delay2abstick() internally
   increments the delay by one tick, using a delay equal to WDOG_MAX_DELAY
   will cause an overflow and make the clock comparison invalid.

   This patch fixes the issue by disallowing the delay to be equal to
   WDOG_MAX_DELAY.

Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>
This commit is contained in:
wangchengdong
2025-11-08 12:20:48 +08:00
committed by archer
parent 00e287bb70
commit de0aead39f

View File

@@ -386,7 +386,7 @@ int wd_start(FAR struct wdog_s *wdog, clock_t delay,
{
/* Ensure delay is within the range the wdog can handle. */
if (delay > WDOG_MAX_DELAY)
if (delay >= WDOG_MAX_DELAY)
{
return -EINVAL;
}