summaryrefslogtreecommitdiff
path: root/lib/efi_loader/efi_memory.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2019-03-21 13:07:42 -0400
committerTom Rini <trini@konsulko.com>2019-03-21 13:07:42 -0400
commitb94b19e729895285cd0c9ed170d20038173d4f07 (patch)
treeeaa8af4493f2ef06e58bd5ce6a6e50d64a8f0e29 /lib/efi_loader/efi_memory.c
parent3d7891d3f3b67a0d150b38afccc0765bd19b0bd2 (diff)
parentd0bd87612f410a723d5ddb3001e805485e3efb4f (diff)
Merge tag 'efi-2019-04-rc5' of git://git.denx.de/u-boot-efi
Pull request for UEFI system for v2019.04-rc5 A bunch of small fixes. The major ones being - avoid illegal memory access in efi_allocate_pool() on 32 bit systems - avoid endless loop in HII protocol
Diffstat (limited to 'lib/efi_loader/efi_memory.c')
-rw-r--r--lib/efi_loader/efi_memory.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c
index ebd2b36c03d..55622d2fb40 100644
--- a/lib/efi_loader/efi_memory.c
+++ b/lib/efi_loader/efi_memory.c
@@ -440,6 +440,7 @@ efi_status_t efi_free_pages(uint64_t memory, efi_uintn_t pages)
efi_status_t efi_allocate_pool(int pool_type, efi_uintn_t size, void **buffer)
{
efi_status_t r;
+ u64 addr;
struct efi_pool_allocation *alloc;
u64 num_pages = efi_size_in_pages(size +
sizeof(struct efi_pool_allocation));
@@ -453,9 +454,9 @@ efi_status_t efi_allocate_pool(int pool_type, efi_uintn_t size, void **buffer)
}
r = efi_allocate_pages(EFI_ALLOCATE_ANY_PAGES, pool_type, num_pages,
- (uint64_t *)&alloc);
-
+ &addr);
if (r == EFI_SUCCESS) {
+ alloc = (struct efi_pool_allocation *)(uintptr_t)addr;
alloc->num_pages = num_pages;
*buffer = alloc->data;
}