mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-12-01 08:59:33 +00: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:
parent
3748ed908f
commit
fa995d0d94
1 changed files with 3 additions and 1 deletions
|
@ -457,11 +457,13 @@ efi_status_t efi_get_memory_map(efi_uintn_t *memory_map_size,
|
|||
efi_uintn_t map_size = 0;
|
||||
int map_entries = 0;
|
||||
struct list_head *lhandle;
|
||||
efi_uintn_t provided_map_size = *memory_map_size;
|
||||
efi_uintn_t provided_map_size;
|
||||
|
||||
if (!memory_map_size)
|
||||
return EFI_INVALID_PARAMETER;
|
||||
|
||||
provided_map_size = *memory_map_size;
|
||||
|
||||
list_for_each(lhandle, &efi_mem)
|
||||
map_entries++;
|
||||
|
||||
|
|
Loading…
Reference in a new issue