mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-24 21:54:01 +00:00
EFI: Populate descriptor_count value only when image_info_size is not zero
The GetImageInfo function of the Firmware Mangement Protocol(FMP) gets called initially to query the size of the image descriptor array that would have to be allocated. During this call, the rest of the function arguments, specifically pointers might be passed as NULL. Do not populate the descriptor_count value before it is known that the call to GetImageInfo has been made with the allocated buffer for the image descriptors. Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org> Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
This commit is contained in:
parent
f1533c41a7
commit
6a463bc1c9
1 changed files with 2 additions and 3 deletions
|
@ -130,9 +130,6 @@ static efi_status_t efi_fill_image_desc_array(
|
|||
struct efi_fw_image *fw_array;
|
||||
int i;
|
||||
|
||||
fw_array = update_info.images;
|
||||
*descriptor_count = num_image_type_guids;
|
||||
|
||||
total_size = sizeof(*image_info) * num_image_type_guids;
|
||||
|
||||
if (*image_info_size < total_size) {
|
||||
|
@ -142,6 +139,8 @@ static efi_status_t efi_fill_image_desc_array(
|
|||
}
|
||||
*image_info_size = total_size;
|
||||
|
||||
fw_array = update_info.images;
|
||||
*descriptor_count = num_image_type_guids;
|
||||
*descriptor_version = EFI_FIRMWARE_IMAGE_DESCRIPTOR_VERSION;
|
||||
*descriptor_size = sizeof(*image_info);
|
||||
*package_version = 0xffffffff; /* not supported */
|
||||
|
|
Loading…
Reference in a new issue