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

CFE_ES_PoolCreateEx NumBlockSizes error handling #1485

Closed
zanzaben opened this issue May 6, 2021 · 4 comments · Fixed by #1562 or #1584
Closed

CFE_ES_PoolCreateEx NumBlockSizes error handling #1485

zanzaben opened this issue May 6, 2021 · 4 comments · Fixed by #1562 or #1584
Assignees
Labels
cFE-ES docs This change only affects documentation.
Milestone

Comments

@zanzaben
Copy link
Contributor

zanzaben commented May 6, 2021

Describe the bug
In the header file of CFE_ES_PoolCreateEx, for parameter NumBlockSizes it says "If set equal to zero or if greater than 17, then default block sizes are used." In the code though if NumBLockSizes is greater than CFE_PLATFORM_ES_POOL_MAX_BUCKETS (which is set to 17) then it returns error code CFE_ES_BAD_ARGUMENT.

Expected behavior
The header and functionality should match.

Reporter Info
Alex Campbell GSFC

@skliper skliper added this to the 7.0.0 milestone May 6, 2021
@skliper skliper added the docs This change only affects documentation. label May 6, 2021
@jphickey
Copy link
Contributor

jphickey commented May 6, 2021

I would vote to make the header/documentation match what the implementation does. Passing in a bad value should be an error.

@zanzaben
Copy link
Contributor Author

zanzaben commented May 6, 2021

That's fine but the implementation for when NumBLocksSizes equals 0 is weird. It will be set to the default only when BlockSizes is null, and will stay as 0 when BlockSizes isn't null.

@jphickey
Copy link
Contributor

jphickey commented May 6, 2021

That's fine but the implementation for when NumBLocksSizes equals 0 is weird. It will be set to the default only when BlockSizes is null, and will stay as 0 when BlockSizes isn't null.

Yeah, it is kinda weird, but I vaguely recall preserving that "feature" of the API (only use default set if the pointer is NULL, regardless of NumBlockSizes). Didn't want to break any code that might be depending on that.

I wouldn't want to change the behavior at this point - we should keep it as being the BlockSizes pointer (NULL or not NULL) that controls whether defaults are used.

As for the case of a BlockSizes != NULL and NumBlockSizes == 0, does this have any major issues? Obviously its a bad config and I don't expect it to do anything useful in that case, but so long as it doesn't crash or otherwise break the system I don't see it as being a major issue. We could consider returning BAD ARGUMENT in that case too, but I don't see it as critical (maybe others have a different opinion).

@skliper
Copy link
Contributor

skliper commented May 6, 2021

Let's just update the documentation to match the behavior for now (Caelum), feel free to open a future work issue to make the implementation make more sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cFE-ES docs This change only affects documentation.
Projects
None yet
4 participants