[PATCH v4 11/19] bootmeth_efi: Check the filename-allocation in the network path

Simon Glass sjg at chromium.org
Sat Nov 16 00:19:18 CET 2024


If the filename cannot be set we should give up. Add the missing error
check.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

(no changes since v2)

Changes in v2:
- Change the tag to bootmeth_efi

 boot/bootmeth_efi.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/boot/bootmeth_efi.c b/boot/bootmeth_efi.c
index f711b9d0598..a2998452666 100644
--- a/boot/bootmeth_efi.c
+++ b/boot/bootmeth_efi.c
@@ -252,6 +252,8 @@ static int distro_efi_read_bootflow_net(struct bootflow *bflow)
 	if (!bootfile_name)
 		return log_msg_ret("bootfile_name", ret);
 	bflow->fname = strdup(bootfile_name);
+	if (!bflow->fname)
+		return log_msg_ret("fi0", -ENOMEM);
 
 	/* do the hideous EFI hack */
 	efi_set_bootdev("Net", "", bflow->fname, map_sysmem(addr, 0),
-- 
2.34.1



More information about the U-Boot mailing list