aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMasahisa Kojima <masahisa.kojima@linaro.org>2023-07-31 17:53:02 +0900
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>2023-08-03 09:21:03 +0200
commitcd87d2c61ce8e8e963de514f2c8ab0f959d6b586 (patch)
tree229bf5afdb654a96d4881094aa11086f0d2807f8 /lib
parent405b736e817bbca360b2fd3329953d3980585df2 (diff)
downloadu-boot-cd87d2c61ce8e8e963de514f2c8ab0f959d6b586.zip
u-boot-cd87d2c61ce8e8e963de514f2c8ab0f959d6b586.tar.gz
u-boot-cd87d2c61ce8e8e963de514f2c8ab0f959d6b586.tar.bz2
efi_loader: check uuid_str_to_bin return value
Check the uuid_str_to_bin return value, skip the node if the image-type-id property is wrong format. Addresses-Coverity-ID: 463145 ("Error handling issues") Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org> Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/efi_loader/efi_firmware.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/efi_loader/efi_firmware.c b/lib/efi_loader/efi_firmware.c
index b557738..9abb29f 100644
--- a/lib/efi_loader/efi_firmware.c
+++ b/lib/efi_loader/efi_firmware.c
@@ -159,7 +159,7 @@ static void efi_firmware_get_lsv_from_dtb(u8 image_index,
const fdt32_t *val;
const char *guid_str;
int len, offset, index;
- int parent;
+ int parent, ret;
*lsv = 0;
@@ -173,7 +173,11 @@ static void efi_firmware_get_lsv_from_dtb(u8 image_index,
guid_str = fdt_getprop(fdt, offset, "image-type-id", &len);
if (!guid_str)
continue;
- uuid_str_to_bin(guid_str, guid.b, UUID_STR_FORMAT_GUID);
+ ret = uuid_str_to_bin(guid_str, guid.b, UUID_STR_FORMAT_GUID);
+ if (ret < 0) {
+ log_warning("Wrong image-type-id format.\n");
+ continue;
+ }
val = fdt_getprop(fdt, offset, "image-index", &len);
if (!val)