Commit 82f7de27 authored by Geert Uytterhoeven's avatar Geert Uytterhoeven Committed by Simon Horman
Browse files

printk: Use %zu to format size_t



When compiling for 32-bit:

    util_lib/elf_info.c: In function ‘dump_dmesg_lockless’:
    util_lib/elf_info.c:1095:39: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘size_t’ {aka ‘unsigned int’} [-Wformat=]
     1095 |   fprintf(stderr, "Failed to malloc %lu bytes for prb: %s\n",
	  |                                     ~~^
	  |                                       |
	  |                                       long unsigned int
	  |                                     %u
     1096 |    printk_ringbuffer_sz, strerror(errno));
	  |    ~~~~~~~~~~~~~~~~~~~~
	  |    |
	  |    size_t {aka unsigned int}
    util_lib/elf_info.c:1101:49: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘size_t’ {aka ‘unsigned int’} [-Wformat=]
     1101 |   fprintf(stderr, "Failed to read prb of size %lu bytes: %s\n",
	  |                                               ~~^
	  |                                                 |
	  |                                                 long unsigned int
	  |                                               %u
     1102 |    printk_ringbuffer_sz, strerror(errno));
	  |    ~~~~~~~~~~~~~~~~~~~~
	  |    |
	  |    size_t {aka unsigned int}

Indeed, "size_t" is "unsigned int" on 32-bit platforms, and "unsigned
long" on 64-bit platforms.

Fix this by formatting using "%zu".

Fixes: 4149df90 ("printk: add support for lockless ringbuffer")
Signed-off-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: default avatarJohn Ogness <john.ogness@linutronix.de>
Signed-off-by: default avatarSimon Horman <horms@verge.net.au>
parent 07b272a0
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment