From 49d225e7bf3a26adfe6093978c04e454c82bd955 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Tue, 17 Aug 2021 15:05:31 +0200 Subject: efi_loader: use correct type for AllocatePages, AllocatePool Use enum efi_memory_type and enum_allocate_type in the definitions of the efi_allocate_pages(), efi_allocate_pool(). In the external UEFI API leave the type as int as the UEFI specification explicitely requires that enums use a 32bit type. Signed-off-by: Heinrich Schuchardt --- lib/efi_loader/efi_memory.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c index be2f655dffd..f4acbee4f9b 100644 --- a/lib/efi_loader/efi_memory.c +++ b/lib/efi_loader/efi_memory.c @@ -454,7 +454,8 @@ static uint64_t efi_find_free_memory(uint64_t len, uint64_t max_addr) * @memory allocated memory * @return status code */ -efi_status_t efi_allocate_pages(int type, int memory_type, +efi_status_t efi_allocate_pages(enum efi_allocate_type type, + enum efi_memory_type memory_type, efi_uintn_t pages, uint64_t *memory) { u64 len = pages << EFI_PAGE_SHIFT; @@ -556,7 +557,7 @@ efi_status_t efi_free_pages(uint64_t memory, efi_uintn_t pages) * @buffer: allocated memory * Return: status code */ -efi_status_t efi_allocate_pool(int pool_type, efi_uintn_t size, void **buffer) +efi_status_t efi_allocate_pool(enum efi_memory_type pool_type, efi_uintn_t size, void **buffer) { efi_status_t r; u64 addr; -- cgit v1.3.1 From 426a15893f16c5f640bf8380b6a9086906e2f659 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Tue, 17 Aug 2021 15:15:23 +0200 Subject: efi_loader: use EfiBootServicesData for device path dp_alloc() was using a constant from the wrong enum resulting in creating device paths in EfiReservedMemory. Signed-off-by: Heinrich Schuchardt --- lib/efi_loader/efi_device_path.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/efi_loader/efi_device_path.c b/lib/efi_loader/efi_device_path.c index 9c3ac712fef..cbdb466da41 100644 --- a/lib/efi_loader/efi_device_path.c +++ b/lib/efi_loader/efi_device_path.c @@ -68,7 +68,7 @@ static void *dp_alloc(size_t sz) { void *buf; - if (efi_allocate_pool(EFI_ALLOCATE_ANY_PAGES, sz, &buf) != + if (efi_allocate_pool(EFI_BOOT_SERVICES_DATA, sz, &buf) != EFI_SUCCESS) { debug("EFI: ERROR: out of memory in %s\n", __func__); return NULL; -- cgit v1.3.1 From 9a4b3c8e914dbb9d06640d8e04db8a06dedca051 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Tue, 17 Aug 2021 16:15:34 +0200 Subject: efi_loader: use EfiBootServicesData for DP to text Memory allocated in the implementation of the EFI_DEVICE_PATH_TO_TEXT_PROTOCOL must be of type EfiBootServicesData. Signed-off-by: Heinrich Schuchardt --- lib/efi_loader/efi_device_path_to_text.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/efi_loader/efi_device_path_to_text.c b/lib/efi_loader/efi_device_path_to_text.c index d46327a1c94..57fa9d97f71 100644 --- a/lib/efi_loader/efi_device_path_to_text.c +++ b/lib/efi_loader/efi_device_path_to_text.c @@ -34,7 +34,7 @@ static u16 *efi_str_to_u16(char *str) efi_status_t ret; len = sizeof(u16) * (utf8_utf16_strlen(str) + 1); - ret = efi_allocate_pool(EFI_ALLOCATE_ANY_PAGES, len, (void **)&out); + ret = efi_allocate_pool(EFI_BOOT_SERVICES_DATA, len, (void **)&out); if (ret != EFI_SUCCESS) return NULL; dst = out; -- cgit v1.3.1