summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorxypron.glpk@gmx.de <xypron.glpk@gmx.de>2017-07-21 17:04:33 (GMT)
committerAlexander Graf <agraf@suse.de>2017-07-24 12:46:01 (GMT)
commit0ecba5db85fb566bcbb3ba96fda85f26f78be22d (patch)
tree6918a5d1fc64ea26811702c940989aa63fb14360 /lib
parentca9193d2b163cd274144edddd29be20cdb5f99a3 (diff)
downloadu-boot-fsl-qoriq-0ecba5db85fb566bcbb3ba96fda85f26f78be22d.tar.xz
efi_memory: do parameter checks first
The parameter checks should be done first. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'lib')
-rw-r--r--lib/efi_loader/efi_memory.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c
index 5c53aaa..c56653f 100644
--- a/lib/efi_loader/efi_memory.c
+++ b/lib/efi_loader/efi_memory.c
@@ -407,6 +407,9 @@ efi_status_t efi_get_memory_map(unsigned long *memory_map_size,
map_size = map_entries * sizeof(struct efi_mem_desc);
+ if (provided_map_size < map_size)
+ return EFI_BUFFER_TOO_SMALL;
+
*memory_map_size = map_size;
if (descriptor_size)
@@ -415,9 +418,6 @@ efi_status_t efi_get_memory_map(unsigned long *memory_map_size,
if (descriptor_version)
*descriptor_version = EFI_MEMORY_DESCRIPTOR_VERSION;
- if (provided_map_size < map_size)
- return EFI_BUFFER_TOO_SMALL;
-
/* Copy list into array */
if (memory_map) {
/* Return the list in ascending order */