* [PATCH nf-next v2] netfilter: nf_conncount: fix wrong variable type
@ 2024-05-31 3:48 Yunjian Wang
2024-06-26 11:32 ` Pablo Neira Ayuso
0 siblings, 1 reply; 2+ messages in thread
From: Yunjian Wang @ 2024-05-31 3:48 UTC (permalink / raw)
To: netfilter-devel
Cc: pablo, kadlec, fw, kuba, davem, coreteam, xudingke, Yunjian Wang
Now there is a issue is that code checks reports a warning: implicit
narrowing conversion from type 'unsigned int' to small type 'u8' (the
'keylen' variable). Fix it by removing the 'keylen' variable.
Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
---
v2: update commit log and remove the 'keylen' variable
---
net/netfilter/nf_conncount.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/net/netfilter/nf_conncount.c b/net/netfilter/nf_conncount.c
index 8715617b02fe..34ba14e59e95 100644
--- a/net/netfilter/nf_conncount.c
+++ b/net/netfilter/nf_conncount.c
@@ -321,7 +321,6 @@ 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;
bool do_gc = true;
spin_lock_bh(&nf_conncount_locks[hash]);
@@ -333,7 +332,7 @@ insert_tree(struct net *net,
rbconn = rb_entry(*rbnode, struct nf_conncount_rb, node);
parent = *rbnode;
- diff = key_diff(key, rbconn->key, keylen);
+ diff = key_diff(key, rbconn->key, data->keylen);
if (diff < 0) {
rbnode = &((*rbnode)->rb_left);
} else if (diff > 0) {
@@ -378,7 +377,7 @@ insert_tree(struct net *net,
conn->tuple = *tuple;
conn->zone = *zone;
- memcpy(rbconn->key, key, sizeof(u32) * keylen);
+ memcpy(rbconn->key, key, sizeof(u32) * data->keylen);
nf_conncount_list_init(&rbconn->list);
list_add(&conn->node, &rbconn->list.head);
@@ -403,7 +402,6 @@ count_tree(struct net *net,
struct rb_node *parent;
struct nf_conncount_rb *rbconn;
unsigned int hash;
- u8 keylen = data->keylen;
hash = jhash2(key, data->keylen, conncount_rnd) % CONNCOUNT_SLOTS;
root = &data->root[hash];
@@ -414,7 +412,7 @@ count_tree(struct net *net,
rbconn = rb_entry(parent, struct nf_conncount_rb, node);
- diff = key_diff(key, rbconn->key, keylen);
+ diff = key_diff(key, rbconn->key, data->keylen);
if (diff < 0) {
parent = rcu_dereference_raw(parent->rb_left);
} else if (diff > 0) {
--
2.33.0
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH nf-next v2] netfilter: nf_conncount: fix wrong variable type
2024-05-31 3:48 [PATCH nf-next v2] netfilter: nf_conncount: fix wrong variable type Yunjian Wang
@ 2024-06-26 11:32 ` Pablo Neira Ayuso
0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2024-06-26 11:32 UTC (permalink / raw)
To: Yunjian Wang; +Cc: netfilter-devel, kadlec, fw, kuba, davem, coreteam, xudingke
On Fri, May 31, 2024 at 11:48:47AM +0800, Yunjian Wang wrote:
> Now there is a issue is that code checks reports a warning: implicit
> narrowing conversion from type 'unsigned int' to small type 'u8' (the
> 'keylen' variable). Fix it by removing the 'keylen' variable.
Applied, thanks
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-06-26 11:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-31 3:48 [PATCH nf-next v2] netfilter: nf_conncount: fix wrong variable type Yunjian Wang
2024-06-26 11:32 ` Pablo Neira Ayuso
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).