nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

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

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