diff options
author | Heinrich Schuchardt <heinrich.schuchardt@canonical.com> | 2023-07-30 12:36:17 +0200 |
---|---|---|
committer | Heinrich Schuchardt <heinrich.schuchardt@canonical.com> | 2023-08-03 09:21:02 +0200 |
commit | ba27563093f4398ebf38e1e505fe50a00a5e17e7 (patch) | |
tree | 5dc7ee60299278f6b76ca6f4139fa63e053b63ae /lib/efi_loader/efi_memory.c | |
parent | b52a277f9b80cf4a3e7f5d534683afc40a8ef0fc (diff) |
efi_loader: out of memory in efi_add_memory_map_pg
Handle out of memory situation in efi_add_memory_map_pg().
Fixes: 5d00995c361c ("efi_loader: Implement memory allocation and map")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Diffstat (limited to 'lib/efi_loader/efi_memory.c')
-rw-r--r-- | lib/efi_loader/efi_memory.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c index e2ca78d935f..2c5d5221a75 100644 --- a/lib/efi_loader/efi_memory.c +++ b/lib/efi_loader/efi_memory.c @@ -282,6 +282,8 @@ static efi_status_t efi_add_memory_map_pg(u64 start, u64 pages, ++efi_memory_map_key; newlist = calloc(1, sizeof(*newlist)); + if (!newlist) + return EFI_OUT_OF_RESOURCES; newlist->desc.type = memory_type; newlist->desc.physical_start = start; newlist->desc.virtual_start = start; |