Skip to contentSkip to conversation

tools: fix format string in tools/imx8image.c

PATCH Applied Milan P. Stanić 3 participants 3 messages Jan 12 – Jan 18 Arm i.MX and Layerscape

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools: fix format string in tools/imx8image.c

on 32bit systems with musl libc compiler emits
warning: format '%lx' expects argument of type 'long unsigned int', but argument 3 has type 'size_t' {aka 'unsigned int'} [-Wformat=]

to fix this use format length modifier 'z' (size_t) instead of 'l'

---
 tools/imx8image.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/imx8image.c +1 -1
index 3cea536b8e8..84f46bcaf37 100644
@@ -815,7 +815,7 @@ static int get_container_image_start_pos(image_t *image_stack, uint32_t align, u
 
 	p = calloc(1, size);
 	if (!p) {
-		fprintf(stderr, "Fail to alloc %lx memory\n", size);
+		fprintf(stderr, "Fail to alloc %zx memory\n", size);
 		exit(EXIT_FAILURE);
 	}
 
Signature · 1 line
2.52.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Milan P. Stanić

on 32bit systems with musl libc compiler emits
warning: format '%lx' expects argument of type 'long unsigned int', but argument 3 has type 'size_t' {aka 'unsigned int'} [-Wformat=]

to fix this use format length modifier 'z' (size_t) instead of 'l'

Signature · 1 line
Tom
reviewer Applied
#2 lore raw
In reply to Milan P. Stanić
Quoted 7 lines · Milan P. Stanić

on 32bit systems with musl libc compiler emits
warning: format '%lx' expects argument of type 'long unsigned int', but argument 3 has type 'size_t' {aka 'unsigned int'} [-Wformat=]

to fix this use format length modifier 'z' (size_t) instead of 'l'

Applied, thanks.