summaryrefslogtreecommitdiff
path: root/lib/efi_loader
diff options
context:
space:
mode:
authorHeinrich Schuchardt <xypron.glpk@gmx.de>2018-08-06 22:28:18 +0200
committerAlexander Graf <agraf@suse.de>2018-08-20 14:41:09 +0200
commitfa995d0d9471b630d2d1942000d5a4f065c5cdd5 (patch)
tree1b538aa8b3c8af56829df3031e128bd937ab1e96 /lib/efi_loader
parent3748ed908fd478b36bf698839632b2514c450513 (diff)
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: 8e835554b36b ("efi_loader: check parameters of GetMemoryMap") Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'lib/efi_loader')
-rw-r--r--lib/efi_loader/efi_memory.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c
index 4b6269f35e..3ee1079e75 100644
--- a/lib/efi_loader/efi_memory.c
+++ b/lib/efi_loader/efi_memory.c
@@ -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++;