RE: [PATCH] issei: Fix size_t printk specifier in heci_{write,read}_buf()

From: Usyskin, Alexander

Date: Wed Jul 22 2026 - 01:58:29 EST


> Subject: [PATCH] issei: Fix size_t printk specifier in heci_{write,read}_buf()
>
> 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
>
> Use '%zu' for printing these values, the proper printk specifier for
> 'size_t'.
>

Thanks for a fix!
Interesting, which checker should catch such errors?

Acked-by: Alexander Usyskin <alexander.usyskin@xxxxxxxxx>

> Fixes: 8bf5e84998c3 ("issei: add heci hardware module")
> Signed-off-by: Nathan Chancellor <nathan@xxxxxxxxxx>
> ---
> drivers/misc/issei/hw_heci.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/misc/issei/hw_heci.c b/drivers/misc/issei/hw_heci.c
> index 35c55de5c67a..501774aa95ff 100644
> --- a/drivers/misc/issei/hw_heci.c
> +++ b/drivers/misc/issei/hw_heci.c
> @@ -371,7 +371,7 @@ static int heci_write_hbuf(struct issei_device *idev,
> const void *data, size_t d
> struct issei_heci_hw *hw = to_heci_hw(idev);
>
> if (!IS_ALIGNED(data_len, CB_SLOT_SIZE)) {
> - dev_err(&idev->dev, "Data size %zu not aligned to slot size
> %lu\n",
> + dev_err(&idev->dev, "Data size %zu not aligned to slot size
> %zu\n",
> data_len, CB_SLOT_SIZE);
> return -EINVAL;
> }
> @@ -401,7 +401,7 @@ static int heci_read_hbuf(struct issei_device *idev,
> void *data, size_t data_len
> u32 *reg_buf = data;
>
> if (!IS_ALIGNED(data_len, CB_SLOT_SIZE)) {
> - dev_err(&idev->dev, "Data size %zu not aligned to slot size
> %lu\n",
> + dev_err(&idev->dev, "Data size %zu not aligned to slot size
> %zu\n",
> data_len, CB_SLOT_SIZE);
> return -EINVAL;
> }
>
> ---
> base-commit: 2cedf2272f1bb42471e646868ac572cc5752bd91
> change-id: 20260721-issei-fix-size_t-specifier-0ec57b79ee45
>
> Best regards,
> --
> Cheers,
> Nathan