sched/wdog/wd_start.c: prevent accessing watch-dog lag if head is NULL

If statement in line 103 could acces wdactivelist.head->lag when head was
NULL which could result in hard fault. The statement was also redundant
as the same condition is checked in the while loop below. This change
remove the if statement to prevent hard fault to occur.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
This commit is contained in:
Michal Lenc
2021-09-03 09:37:43 +02:00
committed by David Sidrane
parent df088c39f0
commit cdfe7b5a54
-5
View File
@@ -98,10 +98,6 @@ static inline void wd_expiration(void)
FAR struct wdog_s *wdog;
wdentry_t func;
/* Check if the watchdog at the head of the list is ready to run */
if (((FAR struct wdog_s *)g_wdactivelist.head)->lag <= 0)
{
/* Process the watchdog at the head of the list as well as any
* other watchdogs that became ready to run at this time
*/
@@ -133,7 +129,6 @@ static inline void wd_expiration(void)
CALL_FUNC(func, wdog->arg);
}
}
}
/****************************************************************************
* Public Functions