Commit 0b88d165 authored by Yunjian Wang's avatar Yunjian Wang Committed by Pablo Neira Ayuso

netfilter: nf_conncount: fix wrong variable type

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: default avatarYunjian Wang <wangyunjian@huawei.com>
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parent 53796b03
...@@ -321,7 +321,6 @@ insert_tree(struct net *net, ...@@ -321,7 +321,6 @@ insert_tree(struct net *net,
struct nf_conncount_rb *rbconn; struct nf_conncount_rb *rbconn;
struct nf_conncount_tuple *conn; struct nf_conncount_tuple *conn;
unsigned int count = 0, gc_count = 0; unsigned int count = 0, gc_count = 0;
u8 keylen = data->keylen;
bool do_gc = true; bool do_gc = true;
spin_lock_bh(&nf_conncount_locks[hash]); spin_lock_bh(&nf_conncount_locks[hash]);
...@@ -333,7 +332,7 @@ insert_tree(struct net *net, ...@@ -333,7 +332,7 @@ insert_tree(struct net *net,
rbconn = rb_entry(*rbnode, struct nf_conncount_rb, node); rbconn = rb_entry(*rbnode, struct nf_conncount_rb, node);
parent = *rbnode; parent = *rbnode;
diff = key_diff(key, rbconn->key, keylen); diff = key_diff(key, rbconn->key, data->keylen);
if (diff < 0) { if (diff < 0) {
rbnode = &((*rbnode)->rb_left); rbnode = &((*rbnode)->rb_left);
} else if (diff > 0) { } else if (diff > 0) {
...@@ -378,7 +377,7 @@ insert_tree(struct net *net, ...@@ -378,7 +377,7 @@ insert_tree(struct net *net,
conn->tuple = *tuple; conn->tuple = *tuple;
conn->zone = *zone; conn->zone = *zone;
memcpy(rbconn->key, key, sizeof(u32) * keylen); memcpy(rbconn->key, key, sizeof(u32) * data->keylen);
nf_conncount_list_init(&rbconn->list); nf_conncount_list_init(&rbconn->list);
list_add(&conn->node, &rbconn->list.head); list_add(&conn->node, &rbconn->list.head);
...@@ -403,7 +402,6 @@ count_tree(struct net *net, ...@@ -403,7 +402,6 @@ count_tree(struct net *net,
struct rb_node *parent; struct rb_node *parent;
struct nf_conncount_rb *rbconn; struct nf_conncount_rb *rbconn;
unsigned int hash; unsigned int hash;
u8 keylen = data->keylen;
hash = jhash2(key, data->keylen, conncount_rnd) % CONNCOUNT_SLOTS; hash = jhash2(key, data->keylen, conncount_rnd) % CONNCOUNT_SLOTS;
root = &data->root[hash]; root = &data->root[hash];
...@@ -414,7 +412,7 @@ count_tree(struct net *net, ...@@ -414,7 +412,7 @@ count_tree(struct net *net,
rbconn = rb_entry(parent, struct nf_conncount_rb, node); 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) { if (diff < 0) {
parent = rcu_dereference_raw(parent->rb_left); parent = rcu_dereference_raw(parent->rb_left);
} else if (diff > 0) { } else if (diff > 0) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment