Skip to contentSkip to conversation

tools: image-host.c: use correct output format

PATCH New Heinrich Schuchardt 3 participants 3 messages Apr 11, 2020 – Apr 24, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools: image-host.c: use correct output format

When building on a 32bit host the following warning occurs:

tools/image-host.c: In function ?fit_image_read_data?:
tools/image-host.c:310:42: warning: format ?%ld? expects argument of type ?long int?, but argument 3 has type ?ssize_t? {aka ?int?} [-Wformat=]
printf("Can't read all file %s (read %ld bytes, expexted %ld)\n",

                                        ~~^
                                        %d
          filename, n, sbuf.st_size);
                    ~

n is of type ssize_t so we should use %zd for printing.

Fixes 7298e422504e ("mkimage: fit: add support to encrypt image with aes")
---
 tools/image-host.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/image-host.c +1 -1
index 4e57ddea96..5bb68965e7 100644
@@ -307,7 +307,7 @@ static int fit_image_read_data(char *filename, unsigned char *data,
 
 	/* Check that we have read all the file */
 	if (n != sbuf.st_size) {
-		printf("Can't read all file %s (read %ld bytes, expexted %ld)\n",
+		printf("Can't read all file %s (read %zd bytes, expexted %ld)\n",
 		       filename, n, sbuf.st_size);
 		goto err;
 	}

--
2.25.1

#1 lore raw

PATCH 1/1 tools: image-host.c: use correct output format

Quoted 12 lines · Heinrich Schuchardt

When building on a 32bit host the following warning occurs:

tools/image-host.c: In function ?fit_image_read_data?:
tools/image-host.c:310:42: warning: format ?%ld? expects argument of type ?long int?, but argument 3 has type ?ssize_t? {aka ?int?} [-Wformat=]
printf("Can't read all file %s (read %ld bytes, expexted %ld)\n",

                                        ~~^
                                        %d
          filename, n, sbuf.st_size);
                    ~
Quoted 7 lines

n is of type ssize_t so we should use %zd for printing.

Fixes 7298e422504e ("mkimage: fit: add support to encrypt image with aes")
---
 tools/image-host.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
#2 lore raw

PATCH 1/1 tools: image-host.c: use correct output format

In reply to Heinrich Schuchardt
Quoted 11 lines · Heinrich Schuchardt

When building on a 32bit host the following warning occurs:

tools/image-host.c: In function ?fit_image_read_data?:
tools/image-host.c:310:42: warning: format ?%ld? expects argument of type ?long int?, but argument 3 has type ?ssize_t? {aka ?int?} [-Wformat=]
printf("Can't read all file %s (read %ld bytes, expexted %ld)\n",

                                        ~~^
                                        %d
          filename, n, sbuf.st_size);
                    ~
Quoted 5 lines

n is of type ssize_t so we should use %zd for printing.

Fixes 7298e422504e ("mkimage: fit: add support to encrypt image with aes")

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200424/7f0bea39/attachment.sig>