Skip to content
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

Incorrect ReturnCode check in CFE_ES_CreateObjects #1698

Closed
jphickey opened this issue Jul 21, 2021 · 2 comments · Fixed by #1699 or #1701
Closed

Incorrect ReturnCode check in CFE_ES_CreateObjects #1698

jphickey opened this issue Jul 21, 2021 · 2 comments · Fixed by #1699 or #1701
Assignees
Milestone

Comments

@jphickey
Copy link
Contributor

Is your feature request related to a problem? Please describe.
The CFE_ES_StartAppTask returns a CFE status. However, when checking the the return code, it is compared to OS_SUCCESS, rather than CFE_SUCCESS.

ReturnCode = CFE_ES_StartAppTask(
&AppRecPtr->MainTaskId, AppRecPtr->AppName, CFE_ES_ObjectTable[i].FuncPtrUnion.MainTaskPtr,
&AppRecPtr->StartParams.MainTaskInfo, CFE_ES_APPID_C(PendingAppId));
/*
* Finalize data in the app table entry, which must be done under lock.
* This transitions the entry from being RESERVED to the real type,
* either MAIN_TASK (success) or returning to INVALID (failure).
*/
CFE_ES_LockSharedData(__func__, __LINE__);
if (ReturnCode == OS_SUCCESS)
{
CFE_ES_AppRecordSetUsed(AppRecPtr, PendingAppId);

Describe the solution you'd like
Check against CFE_SUCCESS

Describe alternatives you've considered
N/A

Additional context
This is just a minor/pedantic correctness issue, since in practice OS_SUCCESS and CFE_SUCCESS are the same value (0). However when scrubbing for type correctness this shows up.

Requester Info
Joseph Hickey, Vantage Systems, Inc.

@jphickey jphickey self-assigned this Jul 21, 2021
@jphickey
Copy link
Contributor Author

jphickey commented Jul 21, 2021

Calling this an "enhancement" since they are the same value and type in practice (so not really "broken" in behavior), but should be fixed in the interest of correctness.

jphickey added a commit to jphickey/cFE that referenced this issue Jul 21, 2021
The return code of CFE_ES_StartAppTask is a CFE status code,
so it should be compared to CFE_SUCCESS, not OS_SUCCESS.
astrogeco added a commit that referenced this issue Jul 21, 2021
@jphickey
Copy link
Contributor Author

I actually noticed a couple more cases of similar status code mismatch in other functions. I can submit a second PR to address them.

Should probably NOT close this issue with the current IC, though.

@skliper skliper added this to the 7.0.0 milestone Jul 22, 2021
paulober pushed a commit to paulober/cFE that referenced this issue Aug 1, 2021
The return code of CFE_ES_StartAppTask is a CFE status code,
so it should be compared to CFE_SUCCESS, not OS_SUCCESS.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants