summaryrefslogtreecommitdiff
path: root/lib/efi_loader/efi_memory.c
diff options
context:
space:
mode:
authorRob Clark <robdclark@gmail.com>2017-07-26 14:34:05 -0400
committerAlexander Graf <agraf@suse.de>2017-07-26 22:09:49 +0200
commita1b24823b6c22ede11d311b05ea862965ea86b0b (patch)
tree3c6dd073d2705734c5708d9b2c326555613d3ae5 /lib/efi_loader/efi_memory.c
parentf4f9993f7ed0384f110324bb048a6cafb535378a (diff)
efi_loader: fix bug in efi_get_memory_map
When booting shim -> fallback -> shim -> grub -> linux the memory map is a bit larger than the size linux passes in on the first call. But in the EFI_BUFFER_TOO_SMALL case we were not passing back the updated size to linux so it would loop forever. Signed-off-by: Rob Clark <robdclark@gmail.com> Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'lib/efi_loader/efi_memory.c')
-rw-r--r--lib/efi_loader/efi_memory.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c
index f59e3ea327..9e079f1fa3 100644
--- a/lib/efi_loader/efi_memory.c
+++ b/lib/efi_loader/efi_memory.c
@@ -407,11 +407,11 @@ efi_status_t efi_get_memory_map(unsigned long *memory_map_size,
map_size = map_entries * sizeof(struct efi_mem_desc);
+ *memory_map_size = map_size;
+
if (provided_map_size < map_size)
return EFI_BUFFER_TOO_SMALL;
- *memory_map_size = map_size;
-
if (descriptor_size)
*descriptor_size = sizeof(struct efi_mem_desc);