Re: [PATCH] issei: Fix size_t printk specifier in heci_{write,read}_buf()
From: Manuel Ebner
Date: Tue Jul 28 2026 - 08:52:17 EST
On Tue, 2026-07-21 at 14:32 -0700, Nathan Chancellor wrote:
> When building for 32-bit platforms, for which 'size_t' is
> 'unsigned int', there are a couple of warnings around incorrect printk
> specifiers:
>
> In file included from drivers/misc/issei/hw_heci.c:7:
> drivers/misc/issei/hw_heci.c: In function 'heci_write_hbuf':
> drivers/misc/issei/hw_heci.c:374:37: error: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'unsigned int' [-Werror=format=]
> 374 | dev_err(&idev->dev, "Data size %zu not aligned to slot size %lu\n",
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ...
> drivers/misc/issei/hw_heci.c:374:79: note: format string is defined here
> 374 | dev_err(&idev->dev, "Data size %zu not aligned to slot size %lu\n",
> | ~~^
> | |
> | long unsigned int
> | %u
> drivers/misc/issei/hw_heci.c: In function 'heci_read_hbuf':
> drivers/misc/issei/hw_heci.c:404:37: error: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'unsigned int' [-Werror=format=]
> 404 | dev_err(&idev->dev, "Data size %zu not aligned to slot size %lu\n",
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ...
> drivers/misc/issei/hw_heci.c:404:79: note: format string is defined here
> 404 | dev_err(&idev->dev, "Data size %zu not aligned to slot size %lu\n",
> | ~~^
> | |
> | long unsigned int
> | %u
> cc1: all warnings being treated as errors
I had the same errors and eight notes:
In file included from drivers/misc/issei/hw_heci.c:7:
drivers/misc/issei/hw_heci.c: In function ‘heci_write_hbuf’:
drivers/misc/issei/hw_heci.c:374:37: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘unsigned int’ [-Werror=format=]
374 | dev_err(&idev->dev, "Data size %zu not aligned to slot size %lu\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./include/linux/dev_printk.h:110:30: note: in definition of macro ‘dev_printk_index_wrap’
110 | _p_func(dev, fmt, ##__VA_ARGS__); \
| ^~~
./include/linux/dev_printk.h:154:56: note: in expansion of macro ‘dev_fmt’
154 | dev_printk_index_wrap(_dev_err, KERN_ERR, dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~
drivers/misc/issei/hw_heci.c:374:17: note: in expansion of macro ‘dev_err’
374 | dev_err(&idev->dev, "Data size %zu not aligned to slot size %lu\n",
| ^~~~~~~
drivers/misc/issei/hw_heci.c:374:79: note: format string is defined here
374 | dev_err(&idev->dev, "Data size %zu not aligned to slot size %lu\n",
| ~~^
| |
| long unsigned int
| %u
drivers/misc/issei/hw_heci.c: In function ‘heci_read_hbuf’:
drivers/misc/issei/hw_heci.c:404:37: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘unsigned int’ [-Werror=format=]
404 | dev_err(&idev->dev, "Data size %zu not aligned to slot size %lu\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./include/linux/dev_printk.h:110:30: note: in definition of macro ‘dev_printk_index_wrap’
110 | _p_func(dev, fmt, ##__VA_ARGS__); \
| ^~~
./include/linux/dev_printk.h:154:56: note: in expansion of macro ‘dev_fmt’
154 | dev_printk_index_wrap(_dev_err, KERN_ERR, dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~
drivers/misc/issei/hw_heci.c:404:17: note: in expansion of macro ‘dev_err’
404 | dev_err(&idev->dev, "Data size %zu not aligned to slot size %lu\n",
| ^~~~~~~
drivers/misc/issei/hw_heci.c:404:79: note: format string is defined here
404 | dev_err(&idev->dev, "Data size %zu not aligned to slot size %lu\n",
| ~~^
| |
| long unsigned int
| %u
cc1: all warnings being treated as errors
Can the notes be improved? If so please advice.
>
> Use '%zu' for printing these values, the proper printk specifier for
> 'size_t'.
>
> Fixes: 8bf5e84998c3 ("issei: add heci hardware module")
> Signed-off-by: Nathan Chancellor <nathan@xxxxxxxxxx>
Reviewed-by Manuel Ebner <manuelebnerli@xxxxxxxxxxx>
Thanks
Manuel
> [...]