Skip to contentSkip to conversation

Fix ppc build warnings

PATCH Applied Geoff Levand 2 participants 6 messages Apr 11, 2018 – Apr 19, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover Fix ppc build warnings

Hi Simon,

Here are a few fixups for warnings generated when building for 32 bit powerpc with gcc-7.2.0.

-Geoff

The following changes since commit 090e8eceed79f3973fee600db3a355ce06530e40:

kexec-tools 2.0.17-rc1 (2018-04-10 11:20:00 +0200)

are available in the git repository at:

https://github.com/glevand/petitboot--kexec-tools.git for-merge-ppc-warn

for you to fetch changes up to a3c8c1d9fa406ff68484225fd9356ac82f8090b9:

purgatory/ppc64: Fix uninitialized warning (2018-04-11 09:44:50 -0700)

----------------------------------------------------------------
Geoff Levand (4):
kexec: Fix printf warning
crashdump-ppc64: Fix integer truncation warning
kexec-elf-rel-ppc64: Fix cast from pointer warning purgatory/ppc64: Fix uninitialized warning

 kexec/arch/ppc64/crashdump-ppc64.h     | 2 +-
 kexec/arch/ppc64/kexec-elf-rel-ppc64.c | 2 +-
 kexec/kexec.c                          | 3 ++-
 purgatory/arch/ppc64/console-ppc64.c   | 2 +-
 4 files changed, 5 insertions(+), 4 deletions(-)
Signature · 7 lines
2.14.1


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#1 lore raw

PATCH 1/4 kexec: Fix printf warning

Fixes warnings like these when building kexec for powerpc (32 bit):

kexec.c: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 2 has type ‘uint64_t

---
 kexec/kexec.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
kexec/kexec.c +2 -1
index 313d9fe..29fa5fa 100644
@@ -20,6 +20,7 @@
  */
 
 #define _GNU_SOURCE
+#include <inttypes.h>
 #include <stdio.h>
 #include <stdarg.h>
 #include <string.h>
@@ -1235,7 +1236,7 @@ static void print_crashkernel_region_size(void)
 		return;
 	}
 
-	printf("%lu\n", (start != end) ? (end - start + 1) : 0UL);
+	printf("%" PRIu64 "\n", (start != end) ? (end - start + 1) : 0UL);
 }
 
 int main(int argc, char *argv[])
Signature · 8 lines
2.14.1



_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#2 lore raw

PATCH 2/4 crashdump-ppc64: Fix integer truncation warning

In reply to Geoff Levand

Fixes warnings like these when building kexec for powerpc (32 bit):

crashdump-ppc64.h: warning: large integer implicitly truncated to unsigned type

---
 kexec/arch/ppc64/crashdump-ppc64.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kexec/arch/ppc64/crashdump-ppc64.h +1 -1
index 87beb39..b0cba8a 100644
@@ -14,7 +14,7 @@ void add_usable_mem_rgns(unsigned long long base, unsigned long long size);
 #define VMALLOCBASE     0xD000000000000000ULL
 
 #define __pa(x)         ((unsigned long)(x)-PAGE_OFFSET)
-#define MAXMEM          (-KERNELBASE-VMALLOCBASE)
+#define MAXMEM          (-(unsigned long)(KERNELBASE-VMALLOCBASE))
 
 #define COMMAND_LINE_SIZE       2048 /* from kernel */
 /* Backup Region, First 64K of System RAM. */
Signature · 8 lines
2.14.1



_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#3 lore raw

PATCH 3/4 kexec-elf-rel-ppc64: Fix cast from pointer warning

In reply to Geoff Levand

Fixes warnings like these when building kexec for powerpc (32 bit):

kexec-elf-rel-ppc64.c: warning: cast from pointer to integer of different size

---
 kexec/arch/ppc64/kexec-elf-rel-ppc64.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kexec/arch/ppc64/kexec-elf-rel-ppc64.c +1 -1
index 5f8e3f2..51b1354 100644
@@ -104,7 +104,7 @@ void machine_apply_elf_rel(struct mem_ehdr *ehdr, struct mem_sym *sym,
 		break;
 
 	case R_PPC64_REL32:
-		*(uint32_t *)location = value - (uint32_t)(uint64_t)location;
+		*(uint32_t *)location = value - (uint32_t)location;
 		break;
 
 	case R_PPC64_TOC:
Signature · 8 lines
2.14.1



_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#4 lore raw

PATCH 4/4 purgatory/ppc64: Fix uninitialized warning

In reply to Geoff Levand

Fixes warnings like these when building kexec for powerpc (32 bit):

console-ppc64.c: warning: ‘*((void *)&buff+8)’ may be used uninitialized

---
 purgatory/arch/ppc64/console-ppc64.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
purgatory/arch/ppc64/console-ppc64.c +1 -1
index b80183c..2403312 100644
@@ -29,7 +29,7 @@ extern int debug;
 
 void putchar(int c)
 {
-	char buff[16];
+	char buff[16] = "";
 	unsigned long *lbuf = (unsigned long *)buff;
 
 	if (!debug) /* running on non pseries */
Signature · 7 lines
2.14.1


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec