Commit 8519b01f authored by Geert Uytterhoeven's avatar Geert Uytterhoeven Committed by Simon Horman
Browse files

kexec: Use %llu/%llx and casts to format uint64_t



When compiling for 32-bit:

    kexec/kexec.c: In function ‘cmdline_add_liveupdate’:
    kexec/kexec.c:1192:30: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘uint64_t’ {aka ‘long long unsigned int’} [-Wformat=]
     1192 |  sprintf(buf, " liveupdate=%luM@0x%lx", lu_sizeM, lu_start);
	  |                            ~~^          ~~~~~~~~
	  |                              |          |
	  |                              |          uint64_t {aka long long unsigned int}
	  |                              long unsigned int
	  |                            %llu
    kexec/kexec.c:1192:37: warning: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘uint64_t’ {aka ‘long long unsigned int’} [-Wformat=]
     1192 |  sprintf(buf, " liveupdate=%luM@0x%lx", lu_sizeM, lu_start);
	  |                                   ~~^             ~~~~~~~~
	  |                                     |             |
	  |                                     |             uint64_t {aka long long unsigned int}
	  |                                     long unsigned int
	  |                                   %llx

Indeed, "uint64_t" is "unsigned long long" on 32-bit formats, and
"unsigned long" on 64-bit formats.

Fix this by casting to "unsigned long long", and formatting using "%llu"
or "%llx".

Fixes: b13984c6 ("kexec: Introduce --load-live-update for xen")
Signed-off-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: default avatarSimon Horman <horms@verge.net.au>
parent 84a6ef00
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment