Skip to contentSkip to conversation

correct call to free_pages to specify memory size in pages, not bytes.

PATCH New Roy Franz 2 participants 3 messages Jul 25, 2013 – Jul 26, 2013

Subsystems (2)
lore
Share & tools
lore

Roy Franz

author
#0 lore raw

PATCH 1/1 correct call to free_pages to specify memory size in pages, not bytes.

I found this bug while working on the EFI stub for ARM - free_pages is being passed memory size in bytes instead of pages. Since this is unrelated to ARM, I am submitting this separately from the patch set that adds EFI stub support for ARM. Those patches will depend on this one, since the code in question is moved to a shared location and shared by both x86 and ARM EFI stubs.

Roy Franz (1):
correct call to free_pages to specify memory size in pages, not
bytes.

 arch/x86/boot/compressed/eboot.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Signature · 1 line
1.7.10.4
author
#1 lore raw

PATCH 1/1 correct call to free_pages to specify memory size in pages, not bytes.

---
 arch/x86/boot/compressed/eboot.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/boot/compressed/eboot.c +1 -1
index d606463..b7388a4 100644
@@ -225,7 +225,7 @@ static void low_free(unsigned long size, unsigned long addr)
 	unsigned long nr_pages;
 
 	nr_pages = round_up(size, EFI_PAGE_SIZE) / EFI_PAGE_SIZE;
-	efi_call_phys2(sys_table->boottime->free_pages, addr, size);
+	efi_call_phys2(sys_table->boottime->free_pages, addr, nr_pages);
 }
 
 static void find_bits(unsigned long mask, u8 *pos, u8 *size)
Signature · 1 line
1.7.10.4
#2 lore raw
Quoted 10 lines · Roy Franz
---
 arch/x86/boot/compressed/eboot.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/boot/compressed/eboot.c +0 -0
index d606463..b7388a4 100644

arch/x86/boot/compressed/eboot.c static void low_free(unsigned long size, unsigned long addr) · line 231

Quoted 8 lines
arch/x86/boot/compressed/eboot.c +1 -1
@@ -225,7 +225,7 @@ static void low_free(unsigned long size, unsigned long addr)
 	unsigned long nr_pages;
 
 	nr_pages = round_up(size, EFI_PAGE_SIZE) / EFI_PAGE_SIZE;
-	efi_call_phys2(sys_table->boottime->free_pages, addr, size);
+	efi_call_phys2(sys_table->boottime->free_pages, addr, nr_pages);
 }
 
 static void find_bits(unsigned long mask, u8 *pos, u8 *size)

Thanks Roy. I pulled this into my urgent queue, as it's obviously a bug and I don't fancy our chances if we ask the firmware to free more memory than it initially allocated.