[PATCH 1/1] efi_loader: out of memory in efi_add_memory_map_pg

Ilias Apalodimas ilias.apalodimas at linaro.org
Mon Jul 31 09:25:48 CEST 2023


On Sun, 30 Jul 2023 at 13:37, Heinrich Schuchardt
<heinrich.schuchardt at canonical.com> wrote:
>
> 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 at canonical.com>
> ---
>  lib/efi_loader/efi_memory.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c
> index c47a0dc219..fbd20f58ca 100644
> --- a/lib/efi_loader/efi_memory.c
> +++ b/lib/efi_loader/efi_memory.c
> @@ -285,6 +285,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;
> --
> 2.40.1
>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas at linaro.org>


More information about the U-Boot mailing list