[PATCH 1/4] kexec: Fix printf warning

Geoff Levand geoff at infradead.org
Wed Apr 11 10:03:11 PDT 2018


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

Signed-off-by: Geoff Levand <geoff at infradead.org>
---
 kexec/kexec.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kexec/kexec.c b/kexec/kexec.c
index 313d9fe..29fa5fa 100644
--- a/kexec/kexec.c
+++ b/kexec/kexec.c
@@ -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[])
-- 
2.14.1





More information about the kexec mailing list