aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/firmware/efi/libstub/mem.c
diff options
context:
space:
mode:
authorLenny Szubowicz <lszubowi@redhat.com>2020-05-07 14:33:32 -0400
committerArd Biesheuvel <ardb@kernel.org>2020-05-14 11:11:18 +0200
commitfd62619598069c974739476d1851a00d665041d7 (patch)
tree1e09c7a397112e1db2c671edc077b3997d6df96b /drivers/firmware/efi/libstub/mem.c
parentefi/earlycon: Fix early printk for wider fonts (diff)
downloadlinux-dev-fd62619598069c974739476d1851a00d665041d7.tar.xz
linux-dev-fd62619598069c974739476d1851a00d665041d7.zip
efi/libstub/x86: Avoid EFI map buffer alloc in allocate_e820()
In allocate_e820(), call the EFI get_memory_map() service directly instead of indirectly via efi_get_memory_map(). This avoids allocation of a buffer and return of the full EFI memory map, which is not needed here and would otherwise need to be freed. Routine allocate_e820() only needs to know how many EFI memory descriptors there are in the map to allocate an adequately sized e820ext buffer, if it's needed. Note that since efi_get_memory_map() returns a memory map buffer sized with extra headroom, allocate_e820() now needs to explicitly factor that into the e820ext size calculation. Signed-off-by: Lenny Szubowicz <lszubowi@redhat.com> Suggested-by: Ard Biesheuvel <ardb@kernel.org> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Diffstat (limited to 'drivers/firmware/efi/libstub/mem.c')
-rw-r--r--drivers/firmware/efi/libstub/mem.c2
1 files changed, 0 insertions, 2 deletions
diff --git a/drivers/firmware/efi/libstub/mem.c b/drivers/firmware/efi/libstub/mem.c
index 869a79c8946f..09f4fa01914e 100644
--- a/drivers/firmware/efi/libstub/mem.c
+++ b/drivers/firmware/efi/libstub/mem.c
@@ -5,8 +5,6 @@
#include "efistub.h"
-#define EFI_MMAP_NR_SLACK_SLOTS 8
-
static inline bool mmap_has_headroom(unsigned long buff_size,
unsigned long map_size,
unsigned long desc_size)