[PATCH 3/9] efi: fix off-by-one in mem_malloc_init(..., end)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The second (end) parameter of mem_malloc_init() denotes the last address
in the malloc region, so we need to subtract one from the current value
to arrive at the correct end. So far this went not noticed, because iomem
doesn't yet display barebox malloc memory region.

Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx>
---
 common/efi/efi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/efi/efi.c b/common/efi/efi.c
index 73cea3703695..ed8158355020 100644
--- a/common/efi/efi.c
+++ b/common/efi/efi.c
@@ -361,7 +361,7 @@ efi_status_t efi_main(efi_handle_t image, efi_system_table_t *sys_table)
 	if (EFI_ERROR(efiret))
 		panic("failed to allocate malloc pool: %s\n",
 		      efi_strerror(efiret));
-	mem_malloc_init((void *)mem, (void *)mem + memsize);
+	mem_malloc_init((void *)mem, (void *)mem + memsize - 1);
 
 	start_barebox();
 
-- 
2.24.0


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux