[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 09/12] efi: Print error messages to grub_efi_allocate_pages_re
From: |
Javier Martinez Canillas |
Subject: |
[PATCH v2 09/12] efi: Print error messages to grub_efi_allocate_pages_real() |
Date: |
Wed, 4 Mar 2020 12:58:48 +0100 |
From: Peter Jones <address@hidden>
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 <address@hidden>
Signed-off-by: Javier Martinez Canillas <address@hidden>
---
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
- [PATCH v2 00/12] A set of trivial patches from the Fedora package, Javier Martinez Canillas, 2020/03/04
- [PATCH v2 01/12] linux/getroot: Handle rssd storage device names, Javier Martinez Canillas, 2020/03/04
- [PATCH v2 02/12] efi: Print more debug info in our module loader, Javier Martinez Canillas, 2020/03/04
- [PATCH v2 03/12] Makefile: Make libgrub.pp depend on config-util.h, Javier Martinez Canillas, 2020/03/04
- [PATCH v2 05/12] normal/completion: Fix possible NULL pointer dereference, Javier Martinez Canillas, 2020/03/04
- [PATCH v2 04/12] kern: Add grub_debug_enabled(), Javier Martinez Canillas, 2020/03/04
- [PATCH v2 06/12] efi/gop: Add support for BLT_ONLY adapters, Javier Martinez Canillas, 2020/03/04
- [PATCH v2 07/12] efi/uga: Use 64 bit for fb_base, Javier Martinez Canillas, 2020/03/04
- [PATCH v2 09/12] efi: Print error messages to grub_efi_allocate_pages_real(),
Javier Martinez Canillas <=
- [PATCH v2 11/12] efi/gop: Add debug output on GOP probing, Javier Martinez Canillas, 2020/03/04
- [PATCH v2 08/12] kern: Make grub_error() more verbose, Javier Martinez Canillas, 2020/03/04
- Re: [PATCH v2 08/12] kern: Make grub_error() more verbose, Daniel Kiper, 2020/03/06