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

libc/minimal: small fixes to malloc() and friends #33439

Closed
wants to merge 1 commit into from

Conversation

npitre
Copy link
Collaborator

@npitre npitre commented Mar 17, 2021

When malloc() is called with a size of 0 we should not set errno to
ENOMEM as there is no actual allocation failure in that case. This
duplicates the realloc() behavior.

Check the return value of sys_mutex_lock() in the free() case to make
Coverity happy (issue #32938).

Replace all CHECKIF() by explicit assertion statements to uniformize
those checks with the free() case which can't return errors. In theory
sys_mutex_lock() will never return an error here anyway.

@npitre npitre requested a review from nashif as a code owner March 17, 2021 16:45
@github-actions github-actions bot added the area: C Library C Standard Library label Mar 17, 2021
When malloc() is called with a size of 0 we should not set errno to
ENOMEM as there is no actual allocation failure in that case. This
duplicates the realloc() behavior.

Check the return value of sys_mutex_lock() in the free() case to make
Coverity happy.

Replace all CHECKIF() by explicit assertion statements to uniformize
those checks with the free() case which can't return errors.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
@npitre
Copy link
Collaborator Author

npitre commented Mar 23, 2021

Superseded by #33630

@npitre npitre closed this Mar 23, 2021
@npitre npitre deleted the memalloc branch March 31, 2021 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: C Library C Standard Library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant