[PATCH 1/1] mkimage: struct stat.st_size may not be long

Tom Rini trini at konsulko.com
Mon Jan 24 17:53:35 CET 2022


On Sat, Jan 15, 2022 at 08:12:56PM +0100, Heinrich Schuchardt wrote:

> The component st_size of struct stat is of type off_t. Depending on the
> system printing it it with %ld leads to a warning:
> 
> tools/mkimage.c:438:54: warning: format '%ld' expects argument of type
> 'long int', but argument 5 has type
> 'off_t' {aka 'long long int'} [-Wformat=]
>   438 |     "%s: Bad size: \"%s\" is not valid image: size %ld < %u\n",
>       |                                                    ~~^
>       |                                                      |
>       |                                                      long int
>       |                                                    %lld
> 
> When comparing an off_t value to a 32bit integer we should not convert to
> uint32_t but to off_t which may be wider.
> 
> Reported-by: Milan P. Stanić <mps at arvanta.net>
> Fixes: 331f0800f1a3 ("mkimage: allow -l to work on block devices on Linux")
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt at canonical.com>
> Reviewed-by: Mark Kettenis <kettenis at openbsd.org>

Applied to u-boot/master, thanks!

-- 
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/20220124/a4b431b9/attachment.sig>


More information about the U-Boot mailing list