[U-Boot] [PATCH] efi.h: Fix truncation of constant value
Eugeniu Rosca
roscaeugeniu at gmail.com
Sat Jul 14 12:20:53 UTC 2018
Starting with commit 867a6ac86dd8 ("efi: Add start-up library code"),
sparse constantly complains about truncated constant value in efi.h:
include/efi.h:176:35: warning: cast truncates bits from constant value (8000000000000000 becomes 0)
This can get quite noisy, preventing real issues to be noticed:
$ make defconfig
*** Default configuration is based on 'sandbox_defconfig'
$ make C=2 -j12 2>&1 | grep truncates | wc -l
441
After the patch is applied:
$ make C=2 -j12 2>&1 | grep truncates | wc -l
0
$ sparse --version
v0.5.2
Fixes: 867a6ac86dd8 ("efi: Add start-up library code")
Signed-off-by: Eugeniu Rosca <erosca at de.adit-jv.com>
---
include/efi.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/include/efi.h b/include/efi.h
index 0fe15e65c06c..3e3f23b42f8a 100644
--- a/include/efi.h
+++ b/include/efi.h
@@ -172,11 +172,11 @@ enum {
EFI_MEMORY_RP_SHIFT = 13, /* read-protect */
EFI_MEMORY_XP_SHIFT = 14, /* execute-protect */
EFI_MEMORY_RUNTIME_SHIFT = 63, /* range requires runtime mapping */
-
- EFI_MEMORY_RUNTIME = 1ULL << EFI_MEMORY_RUNTIME_SHIFT,
- EFI_MEM_DESC_VERSION = 1,
};
+#define EFI_MEMORY_RUNTIME (1ULL << EFI_MEMORY_RUNTIME_SHIFT)
+#define EFI_MEM_DESC_VERSION 1
+
#define EFI_PAGE_SHIFT 12
#define EFI_PAGE_SIZE (1UL << EFI_PAGE_SHIFT)
#define EFI_PAGE_MASK (EFI_PAGE_SIZE - 1)
--
2.18.0
More information about the U-Boot
mailing list