* [PATCH] efi: Print EFI status as hex number instead of uint
@ 2023-06-27 19:18 Glenn Washburn
2023-06-27 20:46 ` Ard Biesheuvel
0 siblings, 1 reply; 3+ messages in thread
From: Glenn Washburn @ 2023-06-27 19:18 UTC (permalink / raw)
To: grub-devel, Daniel Kiper; +Cc: Ard Biesheuvel, Glenn Washburn
EFI status codes are of different classes depending on the first byte and
all error status codes defined in appendix D of the main spec start from 1
and have the high bit set. When printing as a uint, the decimal is a very
large number that needs have the high bit cleared get the spec error code.
This can be easily visually done by a human if the number is printed as hex.
Signed-off-by: Glenn Washburn <development@efficientek.com>
---
grub-core/loader/efi/linux.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c
index c1eef7c9865f..ca6f60519d73 100644
--- a/grub-core/loader/efi/linux.c
+++ b/grub-core/loader/efi/linux.c
@@ -234,7 +234,7 @@ grub_arch_efi_linux_boot_image (grub_addr_t addr, grub_size_t size, char *args)
status = b->start_image (image_handle, 0, NULL);
/* When successful, not reached */
- grub_error (GRUB_ERR_BAD_OS, "start_image() returned %" PRIuGRUB_EFI_UINTN_T, status);
+ grub_error (GRUB_ERR_BAD_OS, "start_image() returned %" PRIxGRUB_EFI_UINTN_T, status);
grub_efi_free_pages ((grub_addr_t) loaded_image->load_options,
GRUB_EFI_BYTES_TO_PAGES (loaded_image->load_options_size));
unload:
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] efi: Print EFI status as hex number instead of uint
2023-06-27 19:18 [PATCH] efi: Print EFI status as hex number instead of uint Glenn Washburn
@ 2023-06-27 20:46 ` Ard Biesheuvel
2023-06-27 23:19 ` Vladimir 'phcoder' Serbinenko
0 siblings, 1 reply; 3+ messages in thread
From: Ard Biesheuvel @ 2023-06-27 20:46 UTC (permalink / raw)
To: Glenn Washburn; +Cc: grub-devel, Daniel Kiper
On Tue, 27 Jun 2023 at 21:19, Glenn Washburn
<development@efficientek.com> wrote:
>
> EFI status codes are of different classes depending on the first byte and
> all error status codes defined in appendix D of the main spec start from 1
> and have the high bit set. When printing as a uint, the decimal is a very
> large number that needs have the high bit cleared get the spec error code.
> This can be easily visually done by a human if the number is printed as hex.
>
> Signed-off-by: Glenn Washburn <development@efficientek.com>
> ---
> grub-core/loader/efi/linux.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c
> index c1eef7c9865f..ca6f60519d73 100644
> --- a/grub-core/loader/efi/linux.c
> +++ b/grub-core/loader/efi/linux.c
> @@ -234,7 +234,7 @@ grub_arch_efi_linux_boot_image (grub_addr_t addr, grub_size_t size, char *args)
> status = b->start_image (image_handle, 0, NULL);
>
> /* When successful, not reached */
> - grub_error (GRUB_ERR_BAD_OS, "start_image() returned %" PRIuGRUB_EFI_UINTN_T, status);
> + grub_error (GRUB_ERR_BAD_OS, "start_image() returned %" PRIxGRUB_EFI_UINTN_T, status);
Maybe add the 0x prefix to the format string as well?
> grub_efi_free_pages ((grub_addr_t) loaded_image->load_options,
> GRUB_EFI_BYTES_TO_PAGES (loaded_image->load_options_size));
> unload:
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] efi: Print EFI status as hex number instead of uint
2023-06-27 20:46 ` Ard Biesheuvel
@ 2023-06-27 23:19 ` Vladimir 'phcoder' Serbinenko
0 siblings, 0 replies; 3+ messages in thread
From: Vladimir 'phcoder' Serbinenko @ 2023-06-27 23:19 UTC (permalink / raw)
To: The development of GNU GRUB
[-- Attachment #1: Type: text/plain, Size: 1910 bytes --]
Le mar. 27 juin 2023, 22:47, Ard Biesheuvel <ardb@kernel.org> a écrit :
> On Tue, 27 Jun 2023 at 21:19, Glenn Washburn
> <development@efficientek.com> wrote:
> >
> > EFI status codes are of different classes depending on the first byte and
> > all error status codes defined in appendix D of the main spec start from
> 1
> > and have the high bit set. When printing as a uint, the decimal is a very
> > large number that needs have the high bit cleared get the spec error
> code.
> > This can be easily visually done by a human if the number is printed as
> hex.
> >
> > Signed-off-by: Glenn Washburn <development@efficientek.com>
> > ---
> > grub-core/loader/efi/linux.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c
> > index c1eef7c9865f..ca6f60519d73 100644
> > --- a/grub-core/loader/efi/linux.c
> > +++ b/grub-core/loader/efi/linux.c
> > @@ -234,7 +234,7 @@ grub_arch_efi_linux_boot_image (grub_addr_t addr,
> grub_size_t size, char *args)
> > status = b->start_image (image_handle, 0, NULL);
> >
> > /* When successful, not reached */
> > - grub_error (GRUB_ERR_BAD_OS, "start_image() returned %"
> PRIuGRUB_EFI_UINTN_T, status);
> > + grub_error (GRUB_ERR_BAD_OS, "start_image() returned %"
> PRIxGRUB_EFI_UINTN_T, status);
>
> Maybe add the 0x prefix to the format string as well?
>
Agreed. Otherwise distinguishing old version with decimal and new with hex
from bug reports will be a problem
>
> > grub_efi_free_pages ((grub_addr_t) loaded_image->load_options,
> > GRUB_EFI_BYTES_TO_PAGES
> (loaded_image->load_options_size));
> > unload:
> > --
> > 2.34.1
> >
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel
>
[-- Attachment #2: Type: text/html, Size: 2939 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-06-27 23:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-27 19:18 [PATCH] efi: Print EFI status as hex number instead of uint Glenn Washburn
2023-06-27 20:46 ` Ard Biesheuvel
2023-06-27 23:19 ` Vladimir 'phcoder' Serbinenko
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.