1
0
Fork 0
forked from nuttx/nuttx-update

timer_create:Checks whether the signo provided by the user is valid

Summary:
  When the user sets an illegal signo, the error will only be known when timer_signotify is triggered during timeout.
By intercepting timer_create, we can directly locate the problem

Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
This commit is contained in:
chenrun1 2024-09-25 17:35:30 +08:00 committed by Xiang Xiao
parent 9b1800d043
commit 9a75519edc

View file

@ -164,7 +164,9 @@ int timer_create(clockid_t clockid, FAR struct sigevent *evp,
/* Sanity checks. */ /* Sanity checks. */
if (timerid == NULL || (clockid != CLOCK_REALTIME && if (timerid == NULL || (clockid != CLOCK_REALTIME &&
clockid != CLOCK_MONOTONIC && clockid != CLOCK_BOOTTIME)) clockid != CLOCK_MONOTONIC && clockid != CLOCK_BOOTTIME) ||
(evp != NULL && evp->sigev_notify == SIGEV_SIGNAL &&
!GOOD_SIGNO(evp->sigev_signo)))
{ {
set_errno(EINVAL); set_errno(EINVAL);
return ERROR; return ERROR;