This is an automated email from the ASF dual-hosted git repository.
archer pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new de0aead39f3 sched/wdog: Fix wd_start() boundary check for
WDOG_MAX_DELAY
de0aead39f3 is described below
commit de0aead39f3acab7720c9469f552b02222dfb6de
Author: wangchengdong <[email protected]>
AuthorDate: Sat Nov 8 12:20:48 2025 +0800
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 <[email protected]>
---
sched/wdog/wd_start.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sched/wdog/wd_start.c b/sched/wdog/wd_start.c
index 20098630ace..a8d2b01f451 100644
--- a/sched/wdog/wd_start.c
+++ b/sched/wdog/wd_start.c
@@ -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;
}