The parameter checks should be done first.
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
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)
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 */