efi_loader: fix efi_debug_image_info_normal allocation
PATCH 1/1 efi_loader: fix efi_debug_image_info_normal allocation
When adding a new EFI Debug Image Info entry, we allocate memory for a new EFI Debug Image Info Normal structure and we add a new entry into the EFI Debug Image Info Table, which is in fact just a pointer to the allocated structure.
However, when allocating memory for the new structure we allocate memory for the wrong type, leading to allocating memory for just a pointer instead of the desired structure.
Fix the type used during allocation.
--- lib/efi_loader/efi_debug_support.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/efi_loader/efi_debug_support.c +1 -1
@@ -111,7 +111,7 @@ efi_status_t efi_core_new_debug_image_info_entry(u32 image_info_type,/* Allocate data for new entry. */ ret =efi_allocate_pool (EFI_BOOT_SERVICES_DATA , -sizeof (union efi_debug_image_info ), +sizeof (struct efi_debug_image_info_normal ), (void **)(&(*table)[index].normal_image));if (ret ==EFI_SUCCESS && (*table)[index].normal_image) {/* Update the entry. */
Signature · 1 line
2.51.0
Quoted 9 lines · Vincent Stehlé
When adding a new EFI Debug Image Info entry, we allocate memory for a new EFI Debug Image Info Normal structure and we add a new entry into the EFI Debug Image Info Table, which is in fact just a pointer to the allocated structure.
However, when allocating memory for the new structure we allocate memory for the wrong type, leading to allocating memory for just a pointer instead of the desired structure.
Quoted 8 lines
Fix the type used during allocation.
Fixes 146546138af5 ("efi: add EFI_DEBUG_IMAGE_INFO for debug")Signed-off-by Vincent Stehlé <[email protected]>Cc Heinrich Schuchardt <[email protected]>Cc Ilias Apalodimas <[email protected]>Cc Tom Rini <[email protected]>Cc Ying-Chun Liu (PaulLiu) <[email protected]>
Quoted 17 lines
--- lib/efi_loader/efi_debug_support.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)lib/efi_loader/efi_debug_support.c +1
-1@@ -111,7 +111,7 @@ efi_status_t efi_core_new_debug_image_info_entry(u32 image_info_type,/* Allocate data for new entry. */ ret =efi_allocate_pool (EFI_BOOT_SERVICES_DATA , -sizeof (union efi_debug_image_info ), +sizeof (struct efi_debug_image_info_normal ), (void **)(&(*table)[index].normal_image));if (ret ==EFI_SUCCESS && (*table)[index].normal_image) {/* Update the entry. */