Browse Source

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>
Rob Clark 7 years ago
parent
commit
a1b24823b6
1 changed files with 2 additions and 2 deletions
  1. 2 2
      lib/efi_loader/efi_memory.c

+ 2 - 2
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);
 	map_size = map_entries * sizeof(struct efi_mem_desc);
 
 
+	*memory_map_size = map_size;
+
 	if (provided_map_size < map_size)
 	if (provided_map_size < map_size)
 		return EFI_BUFFER_TOO_SMALL;
 		return EFI_BUFFER_TOO_SMALL;
 
 
-	*memory_map_size = map_size;
-
 	if (descriptor_size)
 	if (descriptor_size)
 		*descriptor_size = sizeof(struct efi_mem_desc);
 		*descriptor_size = sizeof(struct efi_mem_desc);