Re: [PATCH] tools/testing/shared: catch a failed posix_memalign()

From: SJ Park

Date: Tue Oct 20 2026 - 20:12:38 EST


On Mon, 19 Oct 2026 23:31:28 -0400 "Liam R. Howlett (Google)" <liam@xxxxxxxxxxxxx> wrote:

> posix_memalign() returns zero or a positive error number and never sets
> errno, so the checks for a negative return in kmem_cache_alloc_lru() and
> kmem_cache_alloc_bulk() is not possible. A failed aligned allocation
> carries on with the pointer unset, into the constructor or the memset().
>
> Test for any non-zero return.

Nice catch, makes sense to me.

>
> Signed-off-by: Liam R. Howlett (Google) <liam@xxxxxxxxxxxxx>

Reviewed-by: SJ Park <sj@xxxxxxxxxx>


Thanks,
SJ

[...]