Blame SOURCES/kexec-tools-2.0.20-2-printk-Use-ULL-suffix-for-64-bit-constants.patch

c43617
From 07b272a07164b902acd7d12794f7be033ebf4525 Mon Sep 17 00:00:00 2001
c43617
From: Geert Uytterhoeven <geert+renesas@glider.be>
c43617
Date: Wed, 17 Mar 2021 13:14:49 +0100
c43617
Subject: [PATCH] printk: Use ULL suffix for 64-bit constants
c43617
MIME-Version: 1.0
c43617
Content-Type: text/plain; charset=UTF-8
c43617
Content-Transfer-Encoding: 8bit
c43617
c43617
When compiling for 32-bit:
c43617
c43617
    util_lib/elf_info.c: In function ‘get_desc_state’:
c43617
    util_lib/elf_info.c:923:31: warning: left shift count >= width of type [-Wshift-count-overflow]
c43617
      923 | #define DESC_FLAGS_MASK  (3UL << DESC_FLAGS_SHIFT)
c43617
	  |                               ^~
c43617
    util_lib/elf_info.c:925:25: note: in expansion of macro ‘DESC_FLAGS_MASK’
c43617
      925 | #define DESC_ID_MASK  (~DESC_FLAGS_MASK)
c43617
	  |                         ^~~~~~~~~~~~~~~
c43617
    util_lib/elf_info.c:926:30: note: in expansion of macro ‘DESC_ID_MASK’
c43617
      926 | #define DESC_ID(sv)  ((sv) & DESC_ID_MASK)
c43617
	  |                              ^~~~~~~~~~~~
c43617
    util_lib/elf_info.c:947:12: note: in expansion of macro ‘DESC_ID’
c43617
      947 |  if (id != DESC_ID(state_val))
c43617
	  |            ^~~~~~~
c43617
    util_lib/elf_info.c: In function ‘id_inc’:
c43617
    util_lib/elf_info.c:923:31: warning: left shift count >= width of type [-Wshift-count-overflow]
c43617
      923 | #define DESC_FLAGS_MASK  (3UL << DESC_FLAGS_SHIFT)
c43617
	  |                               ^~
c43617
    util_lib/elf_info.c:925:25: note: in expansion of macro ‘DESC_FLAGS_MASK’
c43617
      925 | #define DESC_ID_MASK  (~DESC_FLAGS_MASK)
c43617
	  |                         ^~~~~~~~~~~~~~~
c43617
    util_lib/elf_info.c:981:15: note: in expansion of macro ‘DESC_ID_MASK’
c43617
      981 |  return (id & DESC_ID_MASK);
c43617
	  |               ^~~~~~~~~~~~
c43617
c43617
Indeed, "unsigned long" constants are 32-bit on 32-bit platforms, and
c43617
64-bit on 64-bit platforms.
c43617
c43617
Fix this by using a "ULL" suffix instead.
c43617
c43617
Fixes: 4149df9005f2cdd2 ("printk: add support for lockless ringbuffer")
c43617
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
c43617
Reviewed-by: John Ogness <john.ogness@linutronix.de>
c43617
Signed-off-by: Simon Horman <horms@verge.net.au>
c43617
---
c43617
 util_lib/elf_info.c | 4 ++--
c43617
 1 file changed, 2 insertions(+), 2 deletions(-)
c43617
c43617
diff --git a/util_lib/elf_info.c b/util_lib/elf_info.c
c43617
index 2f23a44..7c0a2c3 100644
c43617
--- a/util_lib/elf_info.c
c43617
+++ b/util_lib/elf_info.c
c43617
@@ -920,8 +920,8 @@ enum desc_state {
c43617
 
c43617
 #define DESC_SV_BITS		(sizeof(uint64_t) * 8)
c43617
 #define DESC_FLAGS_SHIFT	(DESC_SV_BITS - 2)
c43617
-#define DESC_FLAGS_MASK		(3UL << DESC_FLAGS_SHIFT)
c43617
-#define DESC_STATE(sv)		(3UL & (sv >> DESC_FLAGS_SHIFT))
c43617
+#define DESC_FLAGS_MASK		(3ULL << DESC_FLAGS_SHIFT)
c43617
+#define DESC_STATE(sv)		(3ULL & (sv >> DESC_FLAGS_SHIFT))
c43617
 #define DESC_ID_MASK		(~DESC_FLAGS_MASK)
c43617
 #define DESC_ID(sv)		((sv) & DESC_ID_MASK)
c43617
 
c43617
-- 
c43617
2.31.1
c43617