-
Notifications
You must be signed in to change notification settings - Fork 224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
os/shared/osapi-module.c: the return value of the call to OS_ModuleLoad_Impl should be checked #359
Comments
…_ModuleLoad_Impl
The call to I don't think there is an issue here. |
Wouldn't you want to pass back a failure if it occurs in the load? |
The |
Thanks, I didn't look closely enough at the parameters! So I'm on the same page now, and concur it's implemented as intended. |
I am closing this issue. Now, after the explanation by @jphickey, I am sure that this issue was caused by my misunderstanding of the code. I have left a comment that explains this in more detail: #360 (comment). |
Is your feature request related to a problem? Please describe.
I have noticed this issue while working on making the OSAL's tests pass on macOS (see #352). I am reporting this issue separately from the rest of the changeset suggested there.
The issue is in the following fragment of code as found in the current master branch (as of 64ad0f5):
We can see that the return value of the
OS_ModuleLoad_Impl
is not tested for!= OS_SUCCESS
so the execution can continue even if the call to this function returns an error.This is a direct link to the line:
osal/src/os/shared/osapi-module.c
Line 244 in 64ad0f5
Describe the solution you'd like
Most of the code in OSAL does check the return values:
if(return_code == OS_SUCCESS)
orif(return_code != OS_SUCCESS)
so it makes sense to create such a check in this case too.I am going to create a Pull Request that addresses this issue.
Describe alternatives you've considered
To the best of my knowledge, a proper return value checking is the only way to get fast feedback from a call to the
OS_ModuleLoad_Impl
if something goes wrong.Additional context
None.
Requester Info
Stanislav Pankevich, independent contribution.
The text was updated successfully, but these errors were encountered: