aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorHeinrich Schuchardt <xypron.glpk@gmx.de>2019-04-23 00:30:53 +0200
committerHeinrich Schuchardt <xypron.glpk@gmx.de>2019-04-23 00:37:28 +0200
commitf12bcc9149c32a01dac687718ad126d4d3ba29ba (patch)
treedcc68ab76a00bf3d12ea6354d9262ec4ed56a79a /lib
parent6182495e101f2d3da29e632632c3d6e5035fef8b (diff)
downloadu-boot-f12bcc9149c32a01dac687718ad126d4d3ba29ba.zip
u-boot-f12bcc9149c32a01dac687718ad126d4d3ba29ba.tar.gz
u-boot-f12bcc9149c32a01dac687718ad126d4d3ba29ba.tar.bz2
efi_loader: check memory type in AllocatePages()
The UEFI specification prescribes that AllocatePages() checks the memory type. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Diffstat (limited to 'lib')
-rw-r--r--lib/efi_loader/efi_memory.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c
index 46681dc..987cc6d 100644
--- a/lib/efi_loader/efi_memory.c
+++ b/lib/efi_loader/efi_memory.c
@@ -376,6 +376,10 @@ efi_status_t efi_allocate_pages(int type, int memory_type,
efi_status_t r = EFI_SUCCESS;
uint64_t addr;
+ /* Check import parameters */
+ if (memory_type >= EFI_PERSISTENT_MEMORY_TYPE &&
+ memory_type <= 0x6FFFFFFF)
+ return EFI_INVALID_PARAMETER;
if (!memory)
return EFI_INVALID_PARAMETER;