On Fri, Feb 27, 2026 at 12:27:28AM +0300, Anton Moryakov wrote:

> Add NULL check after memalign() call in get_mem() to prevent
> potential NULL pointer dereference (CWE-476).
> 
> The function memalign() can return NULL on allocation failure.
> Dereferencing the returned pointer without checking for NULL
> may cause a crash in low-memory conditions.
> 
> Changes:
> - Add NULL check after memalign() allocation
> - Return NULL on failure, consistent with function semantics
> 
> This fixes the static analyzer warning:
>   linux_compat.c:34: dereference of memalign return value without NULL check
> 
> Reported-by: static analyzer Svace
> Signed-off-by: Anton Moryakov <[email protected]>

Reviewed-by: Tom Rini <[email protected]>

-- 
Tom

Attachment: signature.asc
Description: PGP signature

Reply via email to