diff --git a/kernel/kheap.c b/kernel/kheap.c index 97c281513cf7b..d1af1eba3a726 100644 --- a/kernel/kheap.c +++ b/kernel/kheap.c @@ -133,6 +133,10 @@ void *k_heap_aligned_alloc(struct k_heap *heap, size_t align, size_t bytes, { SYS_PORT_TRACING_OBJ_FUNC_ENTER(k_heap, aligned_alloc, heap, timeout); + /* A power of 2 as well as 0 is OK */ + __ASSERT((align & (align - 1)) == 0, + "align must be a power of 2"); + void *ret = z_heap_alloc_helper(heap, align, bytes, timeout, sys_heap_aligned_alloc);