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

Andrew Goodbody andrew.goodbody at linaro.org
Wed Jul 2 12:01:38 CEST 2025


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.

Reviewed-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas at linaro.org>
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;
 	int i, j;
 
 	if (!dev) {

-- 
2.39.5



More information about the U-Boot mailing list