All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] efi_loader: check uuid_str_to_bin return value
@ 2023-07-31  8:53 Masahisa Kojima
  2023-08-02 21:36 ` Heinrich Schuchardt
  0 siblings, 1 reply; 2+ messages in thread
From: Masahisa Kojima @ 2023-07-31  8:53 UTC (permalink / raw)
  To: u-boot; +Cc: Heinrich Schuchardt, Ilias Apalodimas, Masahisa Kojima

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>
---
 lib/efi_loader/efi_firmware.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/lib/efi_loader/efi_firmware.c b/lib/efi_loader/efi_firmware.c
index b557738370..9abb29f1df 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)
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] efi_loader: check uuid_str_to_bin return value
  2023-07-31  8:53 [PATCH] efi_loader: check uuid_str_to_bin return value Masahisa Kojima
@ 2023-08-02 21:36 ` Heinrich Schuchardt
  0 siblings, 0 replies; 2+ messages in thread
From: Heinrich Schuchardt @ 2023-08-02 21:36 UTC (permalink / raw)
  To: Masahisa Kojima; +Cc: Ilias Apalodimas, u-boot

On 7/31/23 10:53, Masahisa Kojima wrote:
> 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 <xypron.glpk@gmx.de>

> ---
>   lib/efi_loader/efi_firmware.c | 8 ++++++--
>   1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/lib/efi_loader/efi_firmware.c b/lib/efi_loader/efi_firmware.c
> index b557738370..9abb29f1df 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)

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-08-02 21:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-31  8:53 [PATCH] efi_loader: check uuid_str_to_bin return value Masahisa Kojima
2023-08-02 21:36 ` Heinrich Schuchardt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.