From e5d9960f568dacafd09735c67498984e664e234a Mon Sep 17 00:00:00 2001 From: yushuailong Date: Sat, 26 Sep 2026 12:16:14 +0800 Subject: [PATCH] sched/wdog: Reject zero delay in wd_start_next. wd_start_next() schedules relative to the previous expiration. A zero value reuses that expiration, so a callback can immediately reinsert an already expired watchdog and make wd_expiration() loop without advancing time. Reject non-positive delays to guarantee that the next expiration advances. Assisted-by: OpenAI Codex Signed-off-by: yushuailong --- include/nuttx/wdog.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/nuttx/wdog.h b/include/nuttx/wdog.h index f6e1885f2fa..f2eed9d0e7d 100644 --- a/include/nuttx/wdog.h +++ b/include/nuttx/wdog.h @@ -309,7 +309,7 @@ int wd_start_realtime(FAR struct wdog_s *wdog, * * Input Parameters: * wdog - Pointer of the periodic watchdog. - * delay - Delayed time in system ticks. + * delay - Positive delay in system ticks. * wdentry - Function to call on timeout. * arg - Parameter to pass to wdentry. * @@ -331,7 +331,7 @@ int wd_start_next(FAR struct wdog_s *wdog, clock_t delay, { /* Ensure delay is within the range the wdog can handle. */ - if (delay < 0 || delay > WDOG_MAX_DELAY) + if (delay <= 0 || delay > WDOG_MAX_DELAY) { return -EINVAL; }