Skip to content

k_heap_aligned_alloc: validate the alignment argument #93036

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

npitre
Copy link
Collaborator

@npitre npitre commented Jul 11, 2025

There is a special internal understanding between z_alloc_helper()
and sys_heap_aligned_alloc() for the meaning of non-power-of-two
alignment values. There was a time when z_alloc_helper() was expressed
in terms of k_heap_aligned_alloc() so the later had to accept special
alignment values from the former. This is no longer the case and
k_heap_aligned_alloc() should enforce proper alignment values now.

Signed-off-by: Nicolas Pitre npitre@baylibre.com

There is a special internal understanding between `z_alloc_helper()`
and `sys_heap_aligned_alloc()` for the meaning of non-power-of-two
alignment values. There was a time when `z_alloc_helper()` was expressed
in terms of `k_heap_aligned_alloc()` so the later had to accept special
alignment values from the former. This is no longer the case and
`k_heap_aligned_alloc()` should enforce proper alignment values now.

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

@npitre npitre added this to the v4.2.0 milestone Jul 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants