[PATCH 1/1] tools: spkgimage: correct printf specifier

Marek Vasut marek.vasut at mailbox.org
Tue Jul 4 22:46:50 CEST 2023


On 7/4/23 22:18, Heinrich Schuchardt wrote:
> Compiling on armv7 results in:
> 
> tools/renesas_spkgimage.c: In function ‘spkgimage_parse_config_line’:
> tools/renesas_spkgimage.c:76:66: warning: format ‘%ld’ expects
> argument of type ‘long int’, but argument 3 has type ‘size_t’
> {aka ‘unsigned int’} [-Wformat=]
>     76 |         "config error: unknown keyword on line %ld\n",
>        |                                                ~~^
>        |                                                  |
>        |                                                  long int
>        |                                                %d
>     77 |         line_num);
>        |         ~~~~~~~~
>        |         |
>        |         size_t {aka unsigned int}
> 
> The correct printf specifier for size_t is '%zu'.
> 
> Fixes: afdfcb11f97c ("tools: spkgimage: add Renesas SPKG format")
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt at canonical.com>
> ---
>   tools/renesas_spkgimage.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/renesas_spkgimage.c b/tools/renesas_spkgimage.c
> index fa0a468cc4..605d0ab149 100644
> --- a/tools/renesas_spkgimage.c
> +++ b/tools/renesas_spkgimage.c
> @@ -73,7 +73,7 @@ static int spkgimage_parse_config_line(char *line, size_t line_num)
>   		conf.padding = check_range(name, value, 1, INT_MAX);
>   	} else {
>   		fprintf(stderr,
> -			"config error: unknown keyword on line %ld\n",
> +			"config error: unknown keyword on line %zu\n",
>   			line_num);
>   		return -EINVAL;
>   	}

Reviewed-by: Marek Vasut <marek.vasut+renesas at mailbox.org>

Tom, can you pick this directly for 2023.07 ? It is low impact and fixes 
a warning.


More information about the U-Boot mailing list