Skip to contentSkip to conversation

powerpc: Fix warnings about right shift count

PATCH New Nick Krause 1 participant 1 message Aug 7, 2014 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc: Fix warnings about right shift count

Fix warnings like the following using upper_32_bits(), discussed after mail with someone on kernelnewbies

arch/powerpc/boot/addnote.c:183:3: warning: right shift count >= width of type arch/powerpc/boot/addnote.c:188:3: warning: right shift count >= width of type arch/powerpc/boot/addnote.c:206:3: warning: right shift count >= width of type arch/powerpc/boot/addnote.c:211:3: warning: right shift count >= width of type

---
 arch/powerpc/boot/addnote.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
arch/powerpc/boot/addnote.c +3 -2
index 9d9f6f3..4611c12 100644
@@ -72,7 +72,7 @@ static int e_class = ELFCLASS32;
 #define PUT_16BE(off, v)(buf[off] = ((v) >> 8) & 0xff, \
 			 buf[(off) + 1] = (v) & 0xff)
 #define PUT_32BE(off, v)(PUT_16BE((off), (v) >> 16L), PUT_16BE((off) + 2, (v)))
-#define PUT_64BE(off, v)((PUT_32BE((off), (v) >> 32L), \
+#define PUT_64BE(off, v)((PUT_32BE((off), upper_32_bits(v)), \
 			  PUT_32BE((off) + 4, (v))))
 
 #define GET_16LE(off)	((buf[off]) + (buf[(off)+1] << 8))
@@ -82,7 +82,8 @@ static int e_class = ELFCLASS32;
 #define PUT_16LE(off, v) (buf[off] = (v) & 0xff, \
 			  buf[(off) + 1] = ((v) >> 8) & 0xff)
 #define PUT_32LE(off, v) (PUT_16LE((off), (v)), PUT_16LE((off) + 2, (v) >> 16L))
-#define PUT_64LE(off, v) (PUT_32LE((off), (v)), PUT_32LE((off) + 4, (v) >> 32L))
+#define PUT_64LE(off, v) (PUT_32LE((off), (v)), PUT_32LE((off) + 4, \
+						upper_32_bits(v)))
 
 #define GET_16(off)	(e_data == ELFDATA2MSB ? GET_16BE(off) : GET_16LE(off))
 #define GET_32(off)	(e_data == ELFDATA2MSB ? GET_32BE(off) : GET_32LE(off))
Signature · 1 line
2.0.1