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

Heinrich Schuchardt xypron.glpk at gmx.de
Wed Jul 2 09:13:06 CEST 2025


On 01.07.25 15:38, Andrew Goodbody 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>
> ---
>   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;

CCing Adriano as author of the code.
Did scripts/get_maintainer.pl not show him?

Reviewed-by: Heinrich Schuchardt <xypron.glpk at gmx.de>

>   	int i, j;
>   
>   	if (!dev) {
> 



More information about the U-Boot mailing list