[U-Boot] [PATCH 1/1] efi_memory: do parameter checks first
Heinrich Schuchardt
xypron.glpk at gmx.de
Fri Jul 21 17:04:33 UTC 2017
The parameter checks should be done first.
Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
---
lib/efi_loader/efi_memory.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c
index 5c53aaafdb..c56653f497 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 */
--
2.13.2
More information about the U-Boot
mailing list