The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] issei: Fix size_t printk specifier in heci_{write,read}_buf()
@ 2026-07-21 21:32 Nathan Chancellor
  2026-07-22  5:57 ` Usyskin, Alexander
  0 siblings, 1 reply; 3+ messages in thread
From: Nathan Chancellor @ 2026-07-21 21:32 UTC (permalink / raw)
  To: Alexander Usyskin, Arnd Bergmann, Greg Kroah-Hartman
  Cc: Karol Wachowski, Vitaly Lubart, linux-kernel, Nathan Chancellor

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'.

Fixes: 8bf5e84998c3 ("issei: add heci hardware module")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
 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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [PATCH] issei: Fix size_t printk specifier in heci_{write,read}_buf()
  2026-07-21 21:32 [PATCH] issei: Fix size_t printk specifier in heci_{write,read}_buf() Nathan Chancellor
@ 2026-07-22  5:57 ` Usyskin, Alexander
  2026-07-22 18:53   ` Nathan Chancellor
  0 siblings, 1 reply; 3+ messages in thread
From: Usyskin, Alexander @ 2026-07-22  5:57 UTC (permalink / raw)
  To: Nathan Chancellor, Arnd Bergmann, Greg Kroah-Hartman
  Cc: Karol Wachowski, Vitaly Lubart, linux-kernel@vger.kernel.org

> 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@intel.com>

> Fixes: 8bf5e84998c3 ("issei: add heci hardware module")
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> ---
>  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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] issei: Fix size_t printk specifier in heci_{write,read}_buf()
  2026-07-22  5:57 ` Usyskin, Alexander
@ 2026-07-22 18:53   ` Nathan Chancellor
  0 siblings, 0 replies; 3+ messages in thread
From: Nathan Chancellor @ 2026-07-22 18:53 UTC (permalink / raw)
  To: Usyskin, Alexander
  Cc: Arnd Bergmann, Greg Kroah-Hartman, Karol Wachowski, Vitaly Lubart,
	linux-kernel@vger.kernel.org

On Wed, Jul 22, 2026 at 05:57:53AM +0000, Usyskin, Alexander wrote:
> > 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?

I saw this with both Clang and GCC when building ARCH=i386 allmodconfig.

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

Thanks for the quick response!

-- 
Cheers,
Nathan

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-07-22 18:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-21 21:32 [PATCH] issei: Fix size_t printk specifier in heci_{write,read}_buf() Nathan Chancellor
2026-07-22  5:57 ` Usyskin, Alexander
2026-07-22 18:53   ` Nathan Chancellor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox