diff mbox series

[v4,08/21] efi_loader: efi_allocate_pages is too restrictive

Message ID 20180618152315.34233-9-agraf@suse.de
State Accepted
Commit aa909462d01866354f4cd4534db5f571c2cf1fbb
Headers show
Series sandbox: efi_loader support | expand

Commit Message

Alexander Graf June 18, 2018, 3:23 p.m. UTC
From: Heinrich Schuchardt <xypron.glpk@gmx.de>

When running on the sandbox the stack is not necessarily at a higher memory
address than the highest free memory.

There is no reason why the checking of the highest memory address should be
more restrictive for EFI_ALLOCATE_ANY_PAGES than for
EFI_ALLOCATE_MAX_ADDRESS.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
[agraf: use -1ULL instead]
Signed-off-by: Alexander Graf <agraf@suse.de>
---
 lib/efi_loader/efi_memory.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Alexander Graf June 21, 2018, 3:13 p.m. UTC | #1
> From: Heinrich Schuchardt <xypron.glpk@gmx.de>
> 
> When running on the sandbox the stack is not necessarily at a higher memory
> address than the highest free memory.
> 
> There is no reason why the checking of the highest memory address should be
> more restrictive for EFI_ALLOCATE_ANY_PAGES than for
> EFI_ALLOCATE_MAX_ADDRESS.
> 
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> [agraf: use -1ULL instead]
> Signed-off-by: Alexander Graf <agraf@suse.de>

Thanks, applied to efi-next

Alex
diff mbox series

Patch

diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c
index ec66af98ea..ce29bcc6a3 100644
--- a/lib/efi_loader/efi_memory.c
+++ b/lib/efi_loader/efi_memory.c
@@ -295,7 +295,7 @@  efi_status_t efi_allocate_pages(int type, int memory_type,
 	switch (type) {
 	case EFI_ALLOCATE_ANY_PAGES:
 		/* Any page */
-		addr = efi_find_free_memory(len, gd->start_addr_sp);
+		addr = efi_find_free_memory(len, -1ULL);
 		if (!addr) {
 			r = EFI_NOT_FOUND;
 			break;