[PATCH 3/3] efi_loader: Prevent free of uninitialised pointer

Ilias Apalodimas ilias.apalodimas at linaro.org
Wed Jul 2 08:33:01 CEST 2025


On Tue, 1 Jul 2025 at 16:38, Andrew Goodbody <andrew.goodbody at linaro.org> wrote:
>
> Taking a goto to out_of_resources before receive_lengths is assigned
> will result in an attempt to free an unitialised pointer. Instead
> initialise receive_lengths to NULL on declaration to prevent this from
> occurring.
>
> This issue was found by Smatch.
>
> Signed-off-by: Andrew Goodbody <andrew.goodbody at linaro.org>

Reviewed-by: Ilias Apalodimas <ilias.apalodimas at linaro.org>

> ---
>  lib/efi_loader/efi_net.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/efi_loader/efi_net.c b/lib/efi_loader/efi_net.c
> index 8e708d8d350..3d092523dd5 100644
> --- a/lib/efi_loader/efi_net.c
> +++ b/lib/efi_loader/efi_net.c
> @@ -1130,7 +1130,7 @@ efi_status_t efi_net_register(struct udevice *dev)
>         struct efi_net_obj *netobj;
>         void *transmit_buffer = NULL;
>         uchar **receive_buffer = NULL;
> -       size_t *receive_lengths;
> +       size_t *receive_lengths = NULL;
>         int i, j;
>
>         if (!dev) {
>
> --
> 2.39.5
>


More information about the U-Boot mailing list