* [PATCH net] netfilter: nf_conncount: fix wrong variable type
@ 2024-05-29 1:40 Yunjian Wang
2024-05-29 12:02 ` Florian Westphal
0 siblings, 1 reply; 6+ messages in thread
From: Yunjian Wang @ 2024-05-29 1:40 UTC (permalink / raw)
To: netfilter-devel
Cc: pablo, kadlec, kuba, davem, coreteam, xudingke, Yunjian Wang
'keylen' is supposed to be unsigned int, not u8, so fix it.
Fixes: 2ba39118c10a ("netfilter: nf_conncount: Move locking into count_tree()")
Fixes: c80f10bc973a ("netfilter: nf_conncount: speculative garbage collection on empty lists")
Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
---
net/netfilter/nf_conncount.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/netfilter/nf_conncount.c b/net/netfilter/nf_conncount.c
index 8715617b02fe..4554f4b093fa 100644
--- a/net/netfilter/nf_conncount.c
+++ b/net/netfilter/nf_conncount.c
@@ -321,7 +321,7 @@ insert_tree(struct net *net,
struct nf_conncount_rb *rbconn;
struct nf_conncount_tuple *conn;
unsigned int count = 0, gc_count = 0;
- u8 keylen = data->keylen;
+ unsigned int keylen = data->keylen;
bool do_gc = true;
spin_lock_bh(&nf_conncount_locks[hash]);
@@ -403,7 +403,7 @@ count_tree(struct net *net,
struct rb_node *parent;
struct nf_conncount_rb *rbconn;
unsigned int hash;
- u8 keylen = data->keylen;
+ unsigned int keylen = data->keylen;
hash = jhash2(key, data->keylen, conncount_rnd) % CONNCOUNT_SLOTS;
root = &data->root[hash];
--
2.33.0
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH net] netfilter: nf_conncount: fix wrong variable type
2024-05-29 1:40 [PATCH net] netfilter: nf_conncount: fix wrong variable type Yunjian Wang
@ 2024-05-29 12:02 ` Florian Westphal
2024-05-30 3:02 ` wangyunjian
0 siblings, 1 reply; 6+ messages in thread
From: Florian Westphal @ 2024-05-29 12:02 UTC (permalink / raw)
To: Yunjian Wang
Cc: netfilter-devel, pablo, kadlec, kuba, davem, coreteam, xudingke
Yunjian Wang <wangyunjian@huawei.com> wrote:
> 'keylen' is supposed to be unsigned int, not u8, so fix it.
Its limited to 5, so u8 works fine.
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [PATCH net] netfilter: nf_conncount: fix wrong variable type
2024-05-29 12:02 ` Florian Westphal
@ 2024-05-30 3:02 ` wangyunjian
2024-05-30 7:52 ` Florian Westphal
0 siblings, 1 reply; 6+ messages in thread
From: wangyunjian @ 2024-05-30 3:02 UTC (permalink / raw)
To: Florian Westphal
Cc: netfilter-devel@vger.kernel.org, pablo@netfilter.org,
kadlec@netfilter.org, kuba@kernel.org, davem@davemloft.net,
coreteam@netfilter.org, xudingke
> -----Original Message-----
> From: Florian Westphal [mailto:fw@strlen.de]
> Sent: Wednesday, May 29, 2024 8:03 PM
> To: wangyunjian <wangyunjian@huawei.com>
> Cc: netfilter-devel@vger.kernel.org; pablo@netfilter.org; kadlec@netfilter.org;
> kuba@kernel.org; davem@davemloft.net; coreteam@netfilter.org; xudingke
> <xudingke@huawei.com>
> Subject: Re: [PATCH net] netfilter: nf_conncount: fix wrong variable type
>
> Yunjian Wang <wangyunjian@huawei.com> wrote:
> > 'keylen' is supposed to be unsigned int, not u8, so fix it.
>
> Its limited to 5, so u8 works fine.
Currently, it does not affect the functionality. The main issue is that code
checks will report a warning: implicit narrowing conversion from type
'unsigned int' to small type 'u8'.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net] netfilter: nf_conncount: fix wrong variable type
2024-05-30 3:02 ` wangyunjian
@ 2024-05-30 7:52 ` Florian Westphal
2024-05-30 9:42 ` wangyunjian
0 siblings, 1 reply; 6+ messages in thread
From: Florian Westphal @ 2024-05-30 7:52 UTC (permalink / raw)
To: wangyunjian
Cc: Florian Westphal, netfilter-devel@vger.kernel.org,
pablo@netfilter.org, kadlec@netfilter.org, kuba@kernel.org,
davem@davemloft.net, coreteam@netfilter.org, xudingke
wangyunjian <wangyunjian@huawei.com> wrote:
> > -----Original Message-----
> > From: Florian Westphal [mailto:fw@strlen.de]
> > Sent: Wednesday, May 29, 2024 8:03 PM
> > To: wangyunjian <wangyunjian@huawei.com>
> > Cc: netfilter-devel@vger.kernel.org; pablo@netfilter.org; kadlec@netfilter.org;
> > kuba@kernel.org; davem@davemloft.net; coreteam@netfilter.org; xudingke
> > <xudingke@huawei.com>
> > Subject: Re: [PATCH net] netfilter: nf_conncount: fix wrong variable type
> >
> > Yunjian Wang <wangyunjian@huawei.com> wrote:
> > > 'keylen' is supposed to be unsigned int, not u8, so fix it.
> >
> > Its limited to 5, so u8 works fine.
>
> Currently, it does not affect the functionality. The main issue is that code
> checks will report a warning: implicit narrowing conversion from type
> 'unsigned int' to small type 'u8'.
Then please quote the exact warning in the commit message and remove the
u8 temporary variable in favor of data->keylen.
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [PATCH net] netfilter: nf_conncount: fix wrong variable type
2024-05-30 7:52 ` Florian Westphal
@ 2024-05-30 9:42 ` wangyunjian
2024-05-30 13:13 ` Florian Westphal
0 siblings, 1 reply; 6+ messages in thread
From: wangyunjian @ 2024-05-30 9:42 UTC (permalink / raw)
To: Florian Westphal
Cc: netfilter-devel@vger.kernel.org, pablo@netfilter.org,
kadlec@netfilter.org, kuba@kernel.org, davem@davemloft.net,
coreteam@netfilter.org, xudingke
> -----Original Message-----
> From: Florian Westphal [mailto:fw@strlen.de]
> Sent: Thursday, May 30, 2024 3:52 PM
> To: wangyunjian <wangyunjian@huawei.com>
> Cc: Florian Westphal <fw@strlen.de>; netfilter-devel@vger.kernel.org;
> pablo@netfilter.org; kadlec@netfilter.org; kuba@kernel.org;
> davem@davemloft.net; coreteam@netfilter.org; xudingke
> <xudingke@huawei.com>
> Subject: Re: [PATCH net] netfilter: nf_conncount: fix wrong variable type
>
> wangyunjian <wangyunjian@huawei.com> wrote:
> > > -----Original Message-----
> > > From: Florian Westphal [mailto:fw@strlen.de]
> > > Sent: Wednesday, May 29, 2024 8:03 PM
> > > To: wangyunjian <wangyunjian@huawei.com>
> > > Cc: netfilter-devel@vger.kernel.org; pablo@netfilter.org;
> kadlec@netfilter.org;
> > > kuba@kernel.org; davem@davemloft.net; coreteam@netfilter.org;
> xudingke
> > > <xudingke@huawei.com>
> > > Subject: Re: [PATCH net] netfilter: nf_conncount: fix wrong variable type
> > >
> > > Yunjian Wang <wangyunjian@huawei.com> wrote:
> > > > 'keylen' is supposed to be unsigned int, not u8, so fix it.
> > >
> > > Its limited to 5, so u8 works fine.
> >
> > Currently, it does not affect the functionality. The main issue is that code
> > checks will report a warning: implicit narrowing conversion from type
> > 'unsigned int' to small type 'u8'.
>
> Then please quote the exact warning in the commit message and remove the
> u8 temporary variable in favor of data->keylen.
OK, I will update it. This is not a bugfix, only considered for net-next?
Thanks.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net] netfilter: nf_conncount: fix wrong variable type
2024-05-30 9:42 ` wangyunjian
@ 2024-05-30 13:13 ` Florian Westphal
0 siblings, 0 replies; 6+ messages in thread
From: Florian Westphal @ 2024-05-30 13:13 UTC (permalink / raw)
To: wangyunjian
Cc: Florian Westphal, netfilter-devel@vger.kernel.org,
pablo@netfilter.org, kadlec@netfilter.org, kuba@kernel.org,
davem@davemloft.net, coreteam@netfilter.org, xudingke
wangyunjian <wangyunjian@huawei.com> wrote:
> > Then please quote the exact warning in the commit message and remove the
> > u8 temporary variable in favor of data->keylen.
>
> OK, I will update it. This is not a bugfix, only considered for net-next?
nf-next, yes.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-05-30 13:13 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-29 1:40 [PATCH net] netfilter: nf_conncount: fix wrong variable type Yunjian Wang
2024-05-29 12:02 ` Florian Westphal
2024-05-30 3:02 ` wangyunjian
2024-05-30 7:52 ` Florian Westphal
2024-05-30 9:42 ` wangyunjian
2024-05-30 13:13 ` Florian Westphal
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).