diff mbox series

cifs: fix debug format string in cifs_debug_data_proc_show

Message ID 20230119111853.596560-1-arnd@kernel.org (mailing list archive)
State New, archived
Headers show
Series cifs: fix debug format string in cifs_debug_data_proc_show | expand

Commit Message

Arnd Bergmann Jan. 19, 2023, 11:18 a.m. UTC
From: Arnd Bergmann <arnd@arndb.de>

Printing a size_t as %lu causes a warning on some architectures:

fs/cifs/cifs_debug.c: In function 'cifs_debug_data_proc_show':
fs/cifs/cifs_debug.c:478:75: error: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'size_t' {aka 'unsigned int'} [-Werror=format=]
  478 |                                 seq_printf(m, "\t\tWeight (cur,total): (%lu,%lu)"

Use the correct %zu format string instead.

Fixes: 962a0fd04791 ("cifs: distribute channels across interfaces based on speed")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 fs/cifs/cifs_debug.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Shyam Prasad N Jan. 19, 2023, 1:46 p.m. UTC | #1
On Thu, Jan 19, 2023 at 4:55 PM Arnd Bergmann <arnd@kernel.org> wrote:
>
> From: Arnd Bergmann <arnd@arndb.de>
>
> Printing a size_t as %lu causes a warning on some architectures:
>
> fs/cifs/cifs_debug.c: In function 'cifs_debug_data_proc_show':
> fs/cifs/cifs_debug.c:478:75: error: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'size_t' {aka 'unsigned int'} [-Werror=format=]
>   478 |                                 seq_printf(m, "\t\tWeight (cur,total): (%lu,%lu)"
>
> Use the correct %zu format string instead.
>
> Fixes: 962a0fd04791 ("cifs: distribute channels across interfaces based on speed")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  fs/cifs/cifs_debug.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c
> index f5f07019fc7e..2e644d926e62 100644
> --- a/fs/cifs/cifs_debug.c
> +++ b/fs/cifs/cifs_debug.c
> @@ -475,7 +475,7 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
>                                 cifs_dump_iface(m, iface);
>
>                                 iface_weight = iface->speed / iface_min_speed;
> -                               seq_printf(m, "\t\tWeight (cur,total): (%lu,%lu)"
> +                               seq_printf(m, "\t\tWeight (cur,total): (%zu,%zu)"
>                                            "\n\t\tAllocated channels: %u\n",
>                                            iface->weight_fulfilled,
>                                            iface_weight,
> --
> 2.39.0
>

Hi Arnd,

Thanks for pointing this out.
Steve French Jan. 20, 2023, 7:17 p.m. UTC | #2
merged into cifs-2.6.git for-next

On Thu, Jan 19, 2023 at 7:48 AM Shyam Prasad N via samba-technical
<samba-technical@lists.samba.org> wrote:
>
> On Thu, Jan 19, 2023 at 4:55 PM Arnd Bergmann <arnd@kernel.org> wrote:
> >
> > From: Arnd Bergmann <arnd@arndb.de>
> >
> > Printing a size_t as %lu causes a warning on some architectures:
> >
> > fs/cifs/cifs_debug.c: In function 'cifs_debug_data_proc_show':
> > fs/cifs/cifs_debug.c:478:75: error: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'size_t' {aka 'unsigned int'} [-Werror=format=]
> >   478 |                                 seq_printf(m, "\t\tWeight (cur,total): (%lu,%lu)"
> >
> > Use the correct %zu format string instead.
> >
> > Fixes: 962a0fd04791 ("cifs: distribute channels across interfaces based on speed")
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> > ---
> >  fs/cifs/cifs_debug.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c
> > index f5f07019fc7e..2e644d926e62 100644
> > --- a/fs/cifs/cifs_debug.c
> > +++ b/fs/cifs/cifs_debug.c
> > @@ -475,7 +475,7 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
> >                                 cifs_dump_iface(m, iface);
> >
> >                                 iface_weight = iface->speed / iface_min_speed;
> > -                               seq_printf(m, "\t\tWeight (cur,total): (%lu,%lu)"
> > +                               seq_printf(m, "\t\tWeight (cur,total): (%zu,%zu)"
> >                                            "\n\t\tAllocated channels: %u\n",
> >                                            iface->weight_fulfilled,
> >                                            iface_weight,
> > --
> > 2.39.0
> >
>
> Hi Arnd,
>
> Thanks for pointing this out.
>
> --
> Regards,
> Shyam
>
diff mbox series

Patch

diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c
index f5f07019fc7e..2e644d926e62 100644
--- a/fs/cifs/cifs_debug.c
+++ b/fs/cifs/cifs_debug.c
@@ -475,7 +475,7 @@  static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
 				cifs_dump_iface(m, iface);
 
 				iface_weight = iface->speed / iface_min_speed;
-				seq_printf(m, "\t\tWeight (cur,total): (%lu,%lu)"
+				seq_printf(m, "\t\tWeight (cur,total): (%zu,%zu)"
 					   "\n\t\tAllocated channels: %u\n",
 					   iface->weight_fulfilled,
 					   iface_weight,