This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit e5d9960f568dacafd09735c67498984e664e234a
Author: yushuailong <[email protected]>
AuthorDate: Sat Sep 26 12:16:14 2026 +0800

    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 <[email protected]>
    Signed-off-by: yushuailong <[email protected]>
---
 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;
     }

Reply via email to