Skip to contentSkip to conversation

binfmt_flat: fix format string for u32

PATCH In review Arnd Bergmann 2 participants 2 messages Jul 10, 2017

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

PATCH 1/1 binfmt_flat: fix format string for u32

The types have changed from 'unsigned long' to 'u32', so now the format string is wrong, and produces a harmless warning on arm32:

arm-soc/fs/binfmt_flat.c: In function 'load_flat_file':
arm-soc/fs/binfmt_flat.c:577:25: error: format '%ld' expects argument of type 'long int', but argument 2 has type 'u32 {aka unsigned int}' [-Werror=format=]

This changes it to '%d' instead, matching the 'u32' type.

Fixes 468138d78510 ("binfmt_flat: flat_{get,put}_addr_from_rp() should be able to fail")
---
 fs/binfmt_flat.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/binfmt_flat.c +1 -1
index 69ec23daa25e..96a06197f83a 100644
@@ -574,7 +574,7 @@ static int load_flat_file(struct linux_binprm *bprm,
 				MAX_SHARED_LIBS * sizeof(unsigned long),
 				FLAT_DATA_ALIGN);
 
-		pr_debug("Allocated data+bss+stack (%ld bytes): %lx\n",
+		pr_debug("Allocated data+bss+stack (%d bytes): %lx\n",
 			 data_len + bss_len + stack_len, datapos);
 
 		fpos = ntohl(hdr->data_start);
Signature · 1 line
2.9.0
#1 lore raw
Quoted 2 lines · Arnd Bergmann

The types have changed from 'unsigned long' to 'u32', so now the format string is wrong, and produces a harmless warning on arm32:

[]

Quoted 1 line

This changes it to '%d' instead, matching the 'u32' type.

[]

fs/binfmt_flat.c

Quoted 1 line
fs/binfmt_flat.c +0 -0

[]

fs/binfmt_flat.c static int load_flat_file(struct linux_binprm *bprm, · line 578

Quoted 7 lines
fs/binfmt_flat.c +1 -1
@@ -574,7 +574,7 @@ static int load_flat_file(struct linux_binprm *bprm,
 				MAX_SHARED_LIBS * sizeof(unsigned long),
 				FLAT_DATA_ALIGN);
 
-		pr_debug("Allocated data+bss+stack (%ld bytes): %lx\n",
+		pr_debug("Allocated data+bss+stack (%d bytes): %lx\n",
 			 data_len + bss_len + stack_len, datapos);

Ideally, %u not %d as data_len, bss_len and stack_len are all u32