From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Thu, 28 Nov 2019 13:23:59 +0100 Subject: [PATCH] Fix PRIxGRUB_EFI_STATUS definition The type specifiers were wrongly defined when GRUB_CPU_SIZEOF_VOID_P != 8 since in that case the grub_efi_status_t is a grub_int32_t typedef. This leads to the following covscan warnings: grub-2.02/include/grub/dl.h:29: included_from: Included from here. grub-2.02/include/grub/efi/efi.h:24: included_from: Included from here. grub-2.02/grub-core/kern/efi/tpm.c:4: included_from: Included from here. grub-2.02/grub-core/kern/efi/tpm.c: scope_hint: In function 'grub_tpm_dprintf' grub-2.02/grub-core/kern/efi/tpm.c:170:26: warning: format '%llx' expects argument of type 'long long unsigned int', but argument 5 has type 'grub_efi_status_t' {aka 'int'} [-Wformat=] grub-2.02/include/grub/misc.h:38:88: note: in definition of macro 'grub_dprintf' Related: rhbz#1761811 Signed-off-by: Javier Martinez Canillas --- include/grub/efi/api.h | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h index b337e1a19..6c440c613 100644 --- a/include/grub/efi/api.h +++ b/include/grub/efi/api.h @@ -539,11 +539,16 @@ typedef grub_uint16_t grub_efi_char16_t; typedef grub_efi_intn_t grub_efi_status_t; /* Make grub_efi_status_t reasonably printable. */ #if GRUB_CPU_SIZEOF_VOID_P == 8 -#define PRIxGRUB_EFI_STATUS "lx" -#define PRIdGRUB_EFI_STATUS "ld" +# if GRUB_CPU_SIZEOF_LONG == 8 +# define PRIxGRUB_EFI_STATUS "lx" +# define PRIdGRUB_EFI_STATUS "ld" +# else +# define PRIxGRUB_EFI_STATUS "llx" +# define PRIdGRUB_EFI_STATUS "lld" +# endif #else -#define PRIxGRUB_EFI_STATUS "llx" -#define PRIdGRUB_EFI_STATUS "lld" +# define PRIxGRUB_EFI_STATUS "x" +# define PRIdGRUB_EFI_STATUS "d" #endif #define GRUB_EFI_ERROR_CODE(value) \