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

Refactor to avoid possible uninitialized local variables #783

Closed
skliper opened this issue Feb 9, 2021 · 0 comments · Fixed by #784 or #774
Closed

Refactor to avoid possible uninitialized local variables #783

skliper opened this issue Feb 9, 2021 · 0 comments · Fixed by #784 or #774
Labels
enhancement security unit-test Tickets related to the OSAL unit testing (functional and/or coverage)
Milestone

Comments

@skliper
Copy link
Contributor

skliper commented Feb 9, 2021

Is your feature request related to a problem? Please describe.

OS_common_record_t *OS_ObjectIdGlobalFromToken(const OS_object_token_t *token)
{
static OS_common_record_t fake_record;
int32 status;
OS_common_record_t * recptr;
status = UT_DEFAULT_IMPL(OS_ObjectIdGlobalFromToken);
if (status == 0 &&
UT_Stub_CopyToLocal(UT_KEY(OS_ObjectIdGlobalFromToken), &recptr, sizeof(recptr)) < sizeof(recptr))
{
/* This function should never return null */
recptr = &fake_record;
}
return recptr;
}


Note the only one in non-test code is a false alarm so I'm not marking as a bug and not critical, but easy to squash:

token->obj_idx = OSAL_INDEX_C(local_id);

Describe the solution you'd like
Fix.

Describe alternatives you've considered
None

Additional context
CodeQL warnings

Requester Info
Jacob Hageman - NASA/GSFC

@skliper skliper added this to the 6.0.0 milestone Feb 9, 2021
skliper added a commit to skliper/osal that referenced this issue Feb 9, 2021
@astrogeco astrogeco added security unit-test Tickets related to the OSAL unit testing (functional and/or coverage) labels Feb 12, 2021
astrogeco added a commit that referenced this issue Feb 12, 2021
Fix #783, Initialize locals flagged in static analysis
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement security unit-test Tickets related to the OSAL unit testing (functional and/or coverage)
Projects
None yet
2 participants