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

Possible uninitialized variable (false alarms) - static analysis #1185

Closed
skliper opened this issue Feb 26, 2021 · 2 comments · Fixed by #1241 or #1258
Closed

Possible uninitialized variable (false alarms) - static analysis #1185

skliper opened this issue Feb 26, 2021 · 2 comments · Fixed by #1241 or #1258
Milestone

Comments

@skliper
Copy link
Contributor

skliper commented Feb 26, 2021

Is your feature request related to a problem? Please describe.
All false alarms based on logic, but easy to squash (just initialize).

This one could be avoided w/ simple refactor (move success logic into if) which reduces to one return location (preferred coding style):

uint32 AppIndex;

Just initialize:

CFE_ResourceId_t PendingResourceId;

CFE_ResourceId_t PendingPipeId;

CFE_SB_PipeD_t *pipedptr;

Likely resolved if OS_OpenCreate_t initialized the file descriptor on failure:

osal_id_t AppFile;

osal_id_t FileDescriptor;

Describe the solution you'd like
See above

Describe alternatives you've considered
None

Additional context
CodeQL warnings, wait until #972 is resolved

Requester Info
Jacob Hageman - NASA/GSFC

@skliper skliper added this to the 7.0.0 milestone Feb 26, 2021
@skliper
Copy link
Contributor Author

skliper commented Mar 1, 2021

Note - majority of the osal_id_t file false alarms could be avoided if OS_OpenCreate set the descriptor invalid (OS_OBJECT_ID_UNDEFINED) on failure.

@skliper
Copy link
Contributor Author

skliper commented Mar 17, 2021

Note the cfe_sb_task.c one has been refactored, wasn't obviously an issue so I'll leave for next round of analysis

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant