[PATCH] Use 'long long' for printf() format string and ELF64 numbers.

Bernhard Walle bwalle at suse.de
Sun May 25 16:11:54 EDT 2008


Since 'long long' is 64 bit wide on almost any platform, especially on
32 bit platforms (like i386) while 'long long' is only 64 bit on 64 bit
platforms but 32 bit on 32 bit platforms, 'long long' is more suited and
fixes compiler warnings like

  kexec/crashdump-elf.c:160: warning: format '%lx' expects type \
        'long unsigned int', but argument 4 has type 'Elf64_Off'
  kexec/crashdump-elf.c:160: warning: format '%lx' expects type \
        'long unsigned int', but argument 5 has type 'Elf64_Addr'
  ...
  kexec/crashdump-elf.c:248: warning: format '%lx' expects type \
        'long unsigned int', but argument 8 has type 'Elf64_Xword'

Tested on i686-pc-linux-gnu.

Signed-off-by: Bernhard Walle <bwalle at suse.de>

diff --git a/kexec/crashdump-elf.c b/kexec/crashdump-elf.c
index 7d2befe..f01accb 100644
--- a/kexec/crashdump-elf.c
+++ b/kexec/crashdump-elf.c
@@ -4,12 +4,12 @@
 #endif
 
 #if (ELF_WIDTH == 64)
-#define dbgprintf_phdr(prefix, phdr)					\
-do {									\
-	dbgprintf("%s: p_type = %u, p_offset = 0x%lx p_paddr = 0x%lx "	\
-		"p_vaddr = 0x%lx p_filesz = 0x%lx p_memsz = 0x%lx\n",	\
-		(prefix), (phdr)->p_type, (phdr)->p_offset, (phdr)->p_paddr, \
-		(phdr)->p_vaddr, (phdr)->p_filesz, (phdr)->p_memsz);	\
+#define dbgprintf_phdr(prefix, phdr)						\
+do {										\
+	dbgprintf("%s: p_type = %u, p_offset = 0x%llx p_paddr = 0x%llx "	\
+		"p_vaddr = 0x%llx p_filesz = 0x%llx p_memsz = 0x%llx\n",	\
+		(prefix), (phdr)->p_type, (phdr)->p_offset, (phdr)->p_paddr, 	\
+		(phdr)->p_vaddr, (phdr)->p_filesz, (phdr)->p_memsz);		\
 } while(0)
 #else
 #define dbgprintf_phdr(prefix, phdr)					\



More information about the kexec mailing list