Skip to contentSkip to conversation

netfilter: nf_tables: Remove unused variable nft_net

PATCH In review Yang Li 2 participants 2 messages Nov 1, 2023 – Nov 4, 2023

Subsystems (3)
lore
Share & tools
lore

Yang Li

author
#0 lore raw

PATCH 1/1 netfilter: nf_tables: Remove unused variable nft_net

The code that uses nft_net has been removed, and the nft_pernet function is merely obtaining a reference to shared data through the net pointer. The content of the net pointer is not modified or changed, so both of them should be removed.

silence the warning:
net/netfilter/nft_set_rbtree.c:627:26: warning: variable ‘nft_net’ set but not used

---
 net/netfilter/nft_set_rbtree.c | 2 --
 1 file changed, 2 deletions(-)
net/netfilter/nft_set_rbtree.c +0 -2
index 6f1186abd47b..baa3fea4fe65 100644
@@ -624,14 +624,12 @@ static void nft_rbtree_gc(struct nft_set *set)
 {
 	struct nft_rbtree *priv = nft_set_priv(set);
 	struct nft_rbtree_elem *rbe, *rbe_end = NULL;
-	struct nftables_pernet *nft_net;
 	struct rb_node *node, *next;
 	struct nft_trans_gc *gc;
 	struct net *net;
 
 	set  = nft_set_container_of(priv);
 	net  = read_pnet(&set->net);
-	nft_net = nft_pernet(net);
 
 	gc = nft_trans_gc_alloc(set, 0, GFP_KERNEL);
 	if (!gc)
Signature · 1 line
2.20.1.7.g153144c
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Yang Li

The code that uses nft_net has been removed, and the nft_pernet function is merely obtaining a reference to shared data through the net pointer. The content of the net pointer is not modified or changed, so both of them should be removed.

silence the warning:
net/netfilter/nft_set_rbtree.c:627:26: warning: variable ‘nft_net’ set but not used

I think this is for nf-next, rather than net-next (which is closed).

But as for the change itself, I also noticed this, and am glad to see it being addressed.