Blame SOURCES/0268-Fix-PRIxGRUB_EFI_STATUS-definition.patch

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