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

ES branch missing coverage in CFE_ES_GenPoolRecyclePoolBlock and CFE_ESGenPoolCreatePoolBlock, NULL pointer check #1930

Closed
skliper opened this issue Sep 3, 2021 · 1 comment · Fixed by #2377

Comments

@skliper
Copy link
Contributor

skliper commented Sep 3, 2021

Is your feature request related to a problem? Please describe.
The NULL pointer check in CFE_ES_GenPoolRecyclePoolBlock would require either exposing this internal routine or getting really lucky corrupting the record from a separate task since it's valid from the calling function.

     119                 :         37 :     BucketPtr = CFE_ES_GenPoolGetBucketState(PoolRecPtr, BucketId);
     120 [ +  - ][ +  + ]:         37 :     if (BucketPtr == NULL || BucketPtr->RecycleCount == BucketPtr->ReleaseCount || BucketPtr->FirstOffset == 0)
                 [ +  + ]

here:

BucketPtr = CFE_ES_GenPoolGetBucketState(PoolRecPtr, BucketId);
if (BucketPtr == NULL || BucketPtr->RecycleCount == BucketPtr->ReleaseCount || BucketPtr->FirstOffset == 0)

Same pattern in CFE_ES_GenPoolCreatePoolBlock:

     180                 :         31 :     BucketPtr = CFE_ES_GenPoolGetBucketState(PoolRecPtr, BucketId);
     181         [ -  + ]:         31 :     if (BucketPtr == NULL)
     182                 :            :     {
     183                 :            :         /* no buffers in pool to create */
     184                 :          0 :         return CFE_ES_BUFFER_NOT_IN_POOL;
     185                 :            :     }

here

BucketPtr = CFE_ES_GenPoolGetBucketState(PoolRecPtr, BucketId);
if (BucketPtr == NULL)
{
/* no buffers in pool to create */
return CFE_ES_BUFFER_NOT_IN_POOL;
}

Describe the solution you'd like
Questionable usefulness, since it can likely only be hit if a pool without a mutex is shared between tasks and access is not serialized (BAD!). If the check does remain, could just expose the internal function to force the failure.

Describe alternatives you've considered
None

Additional context
None

Requester Info
Jacob Hageman - NASA/GSFC

@skliper skliper changed the title ES branch missing coverage in CFE_ES_GenPoolRecyclePoolBlock, NULL pointer check ES branch missing coverage in CFE_ES_GenPoolRecyclePoolBlock and CFE_ESGenPoolCreatePoolBlock, NULL pointer check Sep 5, 2021
@avan989
Copy link
Contributor

avan989 commented Jun 13, 2023

I'll work on this. @jphickey @skliper is there any reason why these 2 functions shouldn't be exposed for unit test?

avan989 pushed a commit to avan989/cFE that referenced this issue Jun 14, 2023
update code covearage test for CFE_ES_GenPoolRecyclePoolBlock and
CFE_ES_GenPoolCreatePoolBlock for null pointer check.
avan989 pushed a commit to avan989/cFE that referenced this issue Jun 16, 2023
Fix nasa#1930, add additional coverage test for null pointer check
avan989 pushed a commit to avan989/cFE that referenced this issue Jun 16, 2023
Add code coverage for null pointer check
avan989 pushed a commit to avan989/cFE that referenced this issue Jun 16, 2023
Fix nasa#1930, add code coverage for null check in ES
dzbaker added a commit that referenced this issue Oct 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants