For uniformity with the proper allocators, let's observe the same maximum allocation size they do. Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx> --- common/dummy_malloc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/common/dummy_malloc.c b/common/dummy_malloc.c index 140ba314272a..4973f35650ab 100644 --- a/common/dummy_malloc.c +++ b/common/dummy_malloc.c @@ -11,8 +11,10 @@ void malloc_stats(void) void *memalign(size_t alignment, size_t bytes) { - void *mem = sbrk(bytes + alignment); + void *mem = NULL; + if (alignment <= MALLOC_MAX_SIZE && bytes <= MALLOC_MAX_SIZE) + mem = sbrk(bytes + alignment); if (!mem) { errno = ENOMEM; return NULL; -- 2.39.5