summaryrefslogtreecommitdiff
path: root/lib/efi_loader/efi_memory.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2017-07-31 07:27:45 -0400
committerTom Rini <trini@konsulko.com>2017-07-31 07:27:45 -0400
commit2218b32d88f9b4b4484cea9a8b034ddab0be298b (patch)
tree828c2f1d58b3c16046198afbe8c1338fa255a805 /lib/efi_loader/efi_memory.c
parent55f228b07e2d84938a88737445441e736de41340 (diff)
parentaf65db85b82b161f037e0889ae58bf461217b3f1 (diff)
Merge tag 'signed-efi-next' of git://github.com/agraf/u-boot
Patch queue for efi - 2017-07-29 A lot of EFI greatness this time around. Thanks a lot to the two amazing new contributors Heinrich Schuchardt and Rob Clark we now gain - stable objects across multiple bootefi invocations - fixes for shim - fixes for ipxe - protocol installation - device path conversion to/from text - working "lsefi" support in grub - working notifiers - various bug fixes
Diffstat (limited to 'lib/efi_loader/efi_memory.c')
-rw-r--r--lib/efi_loader/efi_memory.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c
index db2ae19f590..9e079f1fa3a 100644
--- a/lib/efi_loader/efi_memory.c
+++ b/lib/efi_loader/efi_memory.c
@@ -379,6 +379,9 @@ efi_status_t efi_free_pool(void *buffer)
efi_status_t r;
struct efi_pool_allocation *alloc;
+ if (buffer == NULL)
+ return EFI_INVALID_PARAMETER;
+
alloc = container_of(buffer, struct efi_pool_allocation, data);
/* Sanity check, was the supplied address returned by allocate_pool */
assert(((uintptr_t)alloc & EFI_PAGE_MASK) == 0);
@@ -406,15 +409,15 @@ efi_status_t efi_get_memory_map(unsigned long *memory_map_size,
*memory_map_size = map_size;
+ if (provided_map_size < map_size)
+ return EFI_BUFFER_TOO_SMALL;
+
if (descriptor_size)
*descriptor_size = sizeof(struct efi_mem_desc);
if (descriptor_version)
*descriptor_version = EFI_MEMORY_DESCRIPTOR_VERSION;
- if (provided_map_size < map_size)
- return EFI_BUFFER_TOO_SMALL;
-
/* Copy list into array */
if (memory_map) {
/* Return the list in ascending order */
@@ -428,6 +431,8 @@ efi_status_t efi_get_memory_map(unsigned long *memory_map_size,
}
}
+ *map_key = 0;
+
return EFI_SUCCESS;
}