From 60fd8844af5c47f606680f287db4585d783c1964 Mon Sep 17 00:00:00 2001 From: Patrick Wildt Date: Tue, 9 Apr 2019 22:58:30 +0200 Subject: efi: fix memory calculation overflow on 32-bit systems There are Cubox-i machines out there with nearly 4 GiB of RAM. The RAM starts at 0x10000000 with a size of 0xf0000000. Thus the end of RAM is at 0x100000000. This overflows a 32-bit integer, which should be fine since in the EFI memory code the variables used are all 64-bit with a fixed size. Unfortunately EFI_PAGE_MASK, which is used in the EFI memory code to remove the lower bits, is based on the EFI_PAGE_SIZE macro which, uses 1UL with a shift. This means the resulting mask is UL, which is only 32-bit on ARMv7. Use ULL to make sure that even on 32-bit platforms we use a 64-bit long mask. Without this there will be no memory available in the EFI memory map and bootefi will fail allocating pages. Signed-off-by: Patrick Wildt Reviewed-by: Heinrich Schuchardt Reviewed-by: Patrick Delaunay --- include/efi.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/efi.h b/include/efi.h index d98441ab19..3c9d20f8c0 100644 --- a/include/efi.h +++ b/include/efi.h @@ -190,7 +190,7 @@ enum efi_mem_type { #define EFI_MEM_DESC_VERSION 1 #define EFI_PAGE_SHIFT 12 -#define EFI_PAGE_SIZE (1UL << EFI_PAGE_SHIFT) +#define EFI_PAGE_SIZE (1ULL << EFI_PAGE_SHIFT) #define EFI_PAGE_MASK (EFI_PAGE_SIZE - 1) struct efi_mem_desc { -- cgit From 7657ae12f38791be0b89ba5d4423439888cd749c Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Fri, 12 Apr 2019 06:59:49 +0200 Subject: efi_loader: export efi_install_multiple_protocol_interfaces Export function efi_install_multiple_protocol_interfaces() so that we can call it in others parts of the UEFI subsystem. Signed-off-by: Heinrich Schuchardt --- include/efi_loader.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include') diff --git a/include/efi_loader.h b/include/efi_loader.h index 00b81c6010..f7bf732827 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -344,6 +344,9 @@ efi_status_t efi_remove_protocol(const efi_handle_t handle, void *protocol_interface); /* Delete all protocols from a handle */ efi_status_t efi_remove_all_protocols(const efi_handle_t handle); +/* Install multiple protocol interfaces */ +efi_status_t EFIAPI efi_install_multiple_protocol_interfaces + (efi_handle_t *handle, ...); /* Call this to create an event */ efi_status_t efi_create_event(uint32_t type, efi_uintn_t notify_tpl, void (EFIAPI *notify_function) ( -- cgit