mirror of
https://github.com/apache/nuttx.git
synced 2026-10-03 20:27:53 +00: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:
parent
00e287bb70
commit
de0aead39f
1 changed files with 1 additions and 1 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue