mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-11 07:34:31 +00:00
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>
This commit is contained in:
parent
ca9193d2b1
commit
0ecba5db85
1 changed files with 3 additions and 3 deletions
|
@ -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 */
|
||||
|
|
Loading…
Reference in a new issue