tools: image-host.c: use correct output format
authorHeinrich Schuchardt <xypron.glpk@gmx.de>
Sat, 11 Apr 2020 16:36:04 +0000 (18:36 +0200)
committerTom Rini <trini@konsulko.com>
Fri, 24 Apr 2020 14:51:32 +0000 (10:51 -0400)
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")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
tools/image-host.c

index 4e57ddea969cb614b6ff60b22d9f44fe64147610..5bb68965e7632e78a79bfd894a91d92273444a13 100644 (file)
@@ -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;
        }