From: Peter Jones <pjo...@redhat.com> No messages were printed in this function, add some to ease debugging.
Also, the function returns a void * pointer so return NULL instead of 0 to make the code more readable. Signed-off-by: Peter Jones <pjo...@redhat.com> Signed-off-by: Javier Martinez Canillas <javi...@redhat.com> --- grub-core/kern/efi/mm.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c index b02fab1b102..457772d57f2 100644 --- a/grub-core/kern/efi/mm.c +++ b/grub-core/kern/efi/mm.c @@ -125,12 +125,20 @@ grub_efi_allocate_pages_real (grub_efi_physical_address_t address, /* Limit the memory access to less than 4GB for 32-bit platforms. */ if (address > GRUB_EFI_MAX_USABLE_ADDRESS) - return 0; + { + grub_error (GRUB_ERR_BAD_ARGUMENT, + N_("invalid memory address (0x%llx > 0x%llx)"), + address, GRUB_EFI_MAX_USABLE_ADDRESS); + return NULL; + } b = grub_efi_system_table->boot_services; status = efi_call_4 (b->allocate_pages, alloctype, memtype, pages, &address); if (status != GRUB_EFI_SUCCESS) - return 0; + { + grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("out of memory")); + return NULL; + } if (address == 0) { @@ -140,7 +148,10 @@ grub_efi_allocate_pages_real (grub_efi_physical_address_t address, status = efi_call_4 (b->allocate_pages, alloctype, memtype, pages, &address); grub_efi_free_pages (0, pages); if (status != GRUB_EFI_SUCCESS) - return 0; + { + grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("out of memory")); + return NULL; + } } grub_efi_store_alloc (address, pages); -- 2.24.1 _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel