diff options
author | Patrick Georgi <patrick@coreboot.org> | 2024-01-26 19:47:29 +0100 |
---|---|---|
committer | Patrick Georgi <patrick@coreboot.org> | 2024-01-29 19:12:43 +0000 |
commit | c59426f60ddfa85104dff79a5f2c3fabc23f6180 (patch) | |
tree | 177bf75e60ddde0a977f8232b9483fad0c12cee4 /tests/include/stubs/timestamp.h | |
parent | 80c79a5dc31cca9f157cd2f35f435dfa7648ce11 (diff) |
malloc/memalign: Return NULL if the request is too large
It's what this function family is defined to do, we currently don't
usually run into the case (see: not too many die() instances going
around), it's more useful to try to recover, and the JPEG parser can run
into it if the work buffer size exceeds the remaining heap, whereas its
sole user (the bootsplash code) knows what to do when seeing a NULL.
Use xmalloc() if you want an allocation that either works or dies.
tl;dr: That code path isn't usually taken. Right now it crashes. With
this patch it _might_ survive. There is a use-case for doing it like
that now.
Change-Id: I262fbad7daae0ca3aab583fda00665a2592deaa8
Signed-off-by: Patrick Georgi <patrick@coreboot.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/80226
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Martin L Roth <gaumless@gmail.com>
Reviewed-by: Eric Lai <ericllai@google.com>
Diffstat (limited to 'tests/include/stubs/timestamp.h')
0 files changed, 0 insertions, 0 deletions