mirror of
https://github.com/apache/nuttx.git
synced 2025-12-08 02:32:54 +08:00
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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user