mirror of
https://xff.cz/git/u-boot/
synced 2025-09-26 04:51:17 +02:00
efi_loader: avoid NULL dereference in efi_get_memory_map()
We should only dereference parameter memory_map_size after checking that
it is valid.
Fixes: 8e835554b3
("efi_loader: check parameters of GetMemoryMap")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
This commit is contained in:
committed by
Alexander Graf
parent
3748ed908f
commit
fa995d0d94
@@ -457,11 +457,13 @@ efi_status_t efi_get_memory_map(efi_uintn_t *memory_map_size,
|
|||||||
efi_uintn_t map_size = 0;
|
efi_uintn_t map_size = 0;
|
||||||
int map_entries = 0;
|
int map_entries = 0;
|
||||||
struct list_head *lhandle;
|
struct list_head *lhandle;
|
||||||
efi_uintn_t provided_map_size = *memory_map_size;
|
efi_uintn_t provided_map_size;
|
||||||
|
|
||||||
if (!memory_map_size)
|
if (!memory_map_size)
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
|
|
||||||
|
provided_map_size = *memory_map_size;
|
||||||
|
|
||||||
list_for_each(lhandle, &efi_mem)
|
list_for_each(lhandle, &efi_mem)
|
||||||
map_entries++;
|
map_entries++;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user