mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-18 13:11:31 +00:00
efi_loader: check parameters in memory allocation
If no pointer is provided throw an error. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
This commit is contained in:
parent
21b3edfc96
commit
4d5e071ee0
1 changed files with 6 additions and 0 deletions
|
@ -293,6 +293,9 @@ efi_status_t efi_allocate_pages(int type, int memory_type,
|
|||
efi_status_t r = EFI_SUCCESS;
|
||||
uint64_t addr;
|
||||
|
||||
if (!memory)
|
||||
return EFI_INVALID_PARAMETER;
|
||||
|
||||
switch (type) {
|
||||
case EFI_ALLOCATE_ANY_PAGES:
|
||||
/* Any page */
|
||||
|
@ -386,6 +389,9 @@ efi_status_t efi_allocate_pool(int pool_type, efi_uintn_t size, void **buffer)
|
|||
u64 num_pages = (size + sizeof(struct efi_pool_allocation) +
|
||||
EFI_PAGE_MASK) >> EFI_PAGE_SHIFT;
|
||||
|
||||
if (!buffer)
|
||||
return EFI_INVALID_PARAMETER;
|
||||
|
||||
if (size == 0) {
|
||||
*buffer = NULL;
|
||||
return EFI_SUCCESS;
|
||||
|
|
Loading…
Add table
Reference in a new issue