[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAF=yD-KW-XnDvD0i8VbzrkLGNWEY6cPoaEcHy40hbghGXTo+kA@mail.gmail.com>
Date: Tue, 16 Jul 2019 17:04:19 +0200
From: Willem de Bruijn <willemdebruijn.kernel@...il.com>
To: Qian Cai <cai@....pw>
Cc: David Miller <davem@...emloft.net>,
Willem de Bruijn <willemb@...gle.com>,
clang-built-linux@...glegroups.com,
Network Development <netdev@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] skbuff: fix compilation warnings in skb_dump()
On Tue, Jul 16, 2019 at 4:56 PM Qian Cai <cai@....pw> wrote:
>
> The commit 6413139dfc64 ("skbuff: increase verbosity when dumping skb
> data") introduced a few compilation warnings.
>
> net/core/skbuff.c:766:32: warning: format specifies type 'unsigned
> short' but the argument has type 'unsigned int' [-Wformat]
> level, sk->sk_family, sk->sk_type,
> sk->sk_protocol);
> ^~~~~~~~~~~
> net/core/skbuff.c:766:45: warning: format specifies type 'unsigned
> short' but the argument has type 'unsigned int' [-Wformat]
> level, sk->sk_family, sk->sk_type,
> sk->sk_protocol);
> ^~~~~~~~~~~~~~~
Ah, I looked at sk_family (skc_family), which is type unsigned short.
But sk_type and sk_protocol are defined as
unsigned int sk_padding : 1,
sk_kern_sock : 1,
sk_no_check_tx : 1,
sk_no_check_rx : 1,
sk_userlocks : 4,
sk_protocol : 8,
sk_type : 16;
So %u is indeed needed instead of %hu.
> Fix them by using the proper types, and also fix some checkpatch
> warnings by using pr_info().
>
> WARNING: printk() should include KERN_<LEVEL> facility level
> + printk("%ssk family=%hu type=%u proto=%u\n",
Converting printk to pr_info lowers all levels to KERN_INFO.
skb_dump takes an explicit parameter level to be able to log at
KERN_ERR or KERN_WARNING
I would like to avoid those checkpatch warnings, but this is not the
right approach.
> Fixes: 6413139dfc64 ("skbuff: increase verbosity when dumping skb data")
Thanks. For a v2, please mark the target branch, as [PATCH net v2].
Powered by blists - more mailing lists