mirror of
https://git.yoctoproject.org/meta-arm
synced 2026-06-05 14:30:10 +00:00
arm-bsp/uboot: fix null pointer exception for get_image_info
This change is to fix NULL pointer exception for get_image_info API for corstone1000 platform Signed-off-by: Vishnu Banavath <vishnu.banavath@arm.com>
This commit is contained in:
committed by
Jon Mason
parent
edde4cbf68
commit
c1f1a040e7
+60
@@ -0,0 +1,60 @@
|
||||
Upstream-Status: Pending [Not submitted to upstream yet]
|
||||
Signed-off-by: Vishnu Banavath <vishnu.banavath@arm.com>
|
||||
|
||||
From f4d3fcdd4ba747a0fd6875f9626c06ad01b889c7 Mon Sep 17 00:00:00 2001
|
||||
From: Vishnu Banavath <vishnu.banavath@arm.com>
|
||||
Date: Fri, 14 Jan 2022 15:24:18 +0000
|
||||
Subject: [PATCH] efi_loader: fix null pointer exception with get_image_info
|
||||
|
||||
get_img_info API implemented for corstone1000 target does not
|
||||
check the input attributes and as a result uboot crash's with
|
||||
null pointer access. This change is to fix the null pointer
|
||||
exception.
|
||||
|
||||
Signed-off-by: Vishnu Banavath <vishnu.banavath@arm.com>
|
||||
|
||||
diff --git a/lib/efi_loader/efi_firmware.c b/lib/efi_loader/efi_firmware.c
|
||||
index a7f7598eab..d5f4788c8f 100644
|
||||
--- a/lib/efi_loader/efi_firmware.c
|
||||
+++ b/lib/efi_loader/efi_firmware.c
|
||||
@@ -344,26 +344,29 @@ static efi_status_t efi_corstone1000_img_info_get (
|
||||
int i = 0;
|
||||
|
||||
*image_info_size = sizeof(*image_info);
|
||||
- *descriptor_version = EFI_FIRMWARE_IMAGE_DESCRIPTOR_VERSION;
|
||||
- *descriptor_count = 1;//dfu_num;
|
||||
- *descriptor_size = sizeof(*image_info);
|
||||
+ if(descriptor_version)
|
||||
+ *descriptor_version = EFI_FIRMWARE_IMAGE_DESCRIPTOR_VERSION;
|
||||
+ if(descriptor_count)
|
||||
+ *descriptor_count = 1;
|
||||
+ if(descriptor_size)
|
||||
+ *descriptor_size = sizeof(*image_info);
|
||||
if (package_version)
|
||||
*package_version = 0xffffffff; /* not supported */
|
||||
if(package_version_name)
|
||||
*package_version_name = NULL; /* not supported */
|
||||
|
||||
if(image_info == NULL) {
|
||||
- log_info("image_info is null\n");
|
||||
+ log_debug("image_info is null\n");
|
||||
return EFI_BUFFER_TOO_SMALL;
|
||||
}
|
||||
|
||||
- image_info[i].image_index = i;
|
||||
+ image_info[i].image_index = 1;
|
||||
image_info[i].image_type_id = *image_type;
|
||||
image_info[i].image_id = 0;
|
||||
- image_info[i].image_id_name = "wic";
|
||||
- image_info[i].version = 1;
|
||||
+ image_info[i].image_id_name = L"wic image";
|
||||
+ image_info[i].version = 0;
|
||||
image_info[i].version_name = NULL;
|
||||
- image_info[i].size = 0x1000;
|
||||
+ image_info[i].size = 0;
|
||||
image_info[i].attributes_supported = IMAGE_ATTRIBUTE_IMAGE_UPDATABLE |
|
||||
IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED;
|
||||
image_info[i].attributes_setting = IMAGE_ATTRIBUTE_IMAGE_UPDATABLE;
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -61,6 +61,7 @@ SRC_URI:append:corstone1000 = " \
|
||||
file://0049-efi_loader-Fix-loaded-image-alignment.patch \
|
||||
file://0050-Comment-mm_communicate-failure-log.patch \
|
||||
file://0051-efi_loader-send-bootcomplete-message-to-secure-encla.patch \
|
||||
file://0052-efi_loader-fix-null-pointer-exception-with-get_image.patch \
|
||||
"
|
||||
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user