From de0aead39f3acab7720c9469f552b02222dfb6de Mon Sep 17 00:00:00 2001 From: wangchengdong Date: Sat, 8 Nov 2025 12:20:48 +0800 Subject: [PATCH] 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 --- 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; }