-
Notifications
You must be signed in to change notification settings - Fork 253
Description
Describe the bug
In the internal OS_TaskPrepare() routine, it calls a low-level implementation routine but does not propagate the return code.
To Reproduce
More theoretical than real. In POSIX this depends on the underlying pthread_setspecific() routine returning an error, of which the only documented error (at least per POSIX) is ENOMEM. However that doesn't mean that there couldn't be other implementation-specific errors on other systems.
Expected behavior
If the OS_TaskRegister_Impl() fails, this result should be propagated up the stack and prevent the task from starting.
Code snips
See here:
osal/src/os/shared/src/osapi-task.c
Lines 117 to 125 in 8cfd6fe
| if (return_code == OS_SUCCESS) | |
| { | |
| OS_TaskRegister_Impl(task_id); | |
| } | |
| else | |
| { | |
| *entrypt = NULL; | |
| } | |
System observed on:
Additional context
If this fails then it means dependent routines like OS_TaskGetId() will also be broken, so it really should block startup of the task and return the error to the caller. Catching this type of error early, when possible, is usually better than getting an obfuscated error later.
Reporter Info
Joseph Hickey, Vantage Systems, Inc.