[PATCH] malloc: return ZERO_SIZE_PTR for 0-byte allocations
Sascha Hauer
s.hauer at pengutronix.de
Fri Mar 14 09:11:33 PDT 2025
On Thu, 13 Mar 2025 09:56:58 +0100, Ahmad Fatoum wrote:
> Linux kmalloc doesn't return NULL on 0-byte allocations, but returns a
> fixed ZERO_PSIZE_PTR constant, which triggers a NULL page exception when
> dereferenced.
>
> However, in barebox, allocator behavior differs:
>
> - glibc returns an unique pointer, but the standard also allows
> libc implementations to return NULL
> - tlsf returns NULL
> - dlmalloc returns a unique pointer
> - dummy malloc returns a unique pointer
>
> [...]
Applied, thanks!
[1/1] malloc: return ZERO_SIZE_PTR for 0-byte allocations
https://git.pengutronix.de/cgit/barebox/commit/?id=3f5b270289be (link may not be stable)
Best regards,
--
Sascha Hauer <s.hauer at pengutronix.de>
More information about the barebox
mailing list