From: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Date: Wed, 17 Apr 2024 16:01:25 +0000 (+0200)
Subject: cmd: eficonfig: check initrd path allocation
X-Git-Tag: v2025.01-rc5-pxa1908~521^2~7
X-Git-Url: http://git.dujemihanovic.xyz/img/static//%22brlog.php?a=commitdiff_plain;h=8afeab4cdf5e7babdf86c2c86d527badada7da1d;p=u-boot.git

cmd: eficonfig: check initrd path allocation

After allocating memory for the initrd file path we need to check the
initrd buffer pointer is not NULL.

Fixes: 87d791423ac6 ("eficonfig: menu-driven addition of UEFI boot option")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
---

diff --git a/cmd/eficonfig.c b/cmd/eficonfig.c
index 8234e602b8..0ba92c60e0 100644
--- a/cmd/eficonfig.c
+++ b/cmd/eficonfig.c
@@ -1419,7 +1419,7 @@ static efi_status_t eficonfig_edit_boot_option(u16 *varname, struct eficonfig_bo
 	}
 
 	bo->initrd_info.current_path = calloc(1, EFICONFIG_FILE_PATH_BUF_SIZE);
-	if (!bo->file_info.current_path) {
+	if (!bo->initrd_info.current_path) {
 		ret =  EFI_OUT_OF_RESOURCES;
 		goto out;
 	}