We should only dereference parameter memory_map_size after checking that
it is valid.
Fixes: 8e835554b36b ("efi_loader: check parameters of GetMemoryMap")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
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++;