Skip to contentSkip to conversation

netfilter: nftables: fix warning in nft_reject

PATCH In review Eric Leblond 2 participants 2 messages Jan 6, 2014 – Jan 7, 2014 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 52cb0425.bwwhbZOarZlZjGHg%[email protected]

#1 lore raw

PATCH 1/1 netfilter: nftables: fix warning in nft_reject

The 0-day testing from Fenguang Wu issued the following warning:
net/netfilter/nft_reject.c: In function 'nft_reject_eval':

Quoted 1 line
Quoted 1 line

net/netfilter/nft_reject.c:37:14: warning: unused variable 'net' [-Wunused-variable]

      struct net *net = dev_net((pkt->in != NULL) ? pkt->in : pkt->out);

This is due to the fact that if IPv6 is not build the variable is indeed unused.

---
 net/netfilter/nft_reject.c | 2 ++
 1 file changed, 2 insertions(+)
net/netfilter/nft_reject.c +2 -0
index 0d690d4..c65fbd8 100644
@@ -34,7 +34,9 @@ static void nft_reject_eval(const struct nft_expr *expr,
 			      const struct nft_pktinfo *pkt)
 {
 	struct nft_reject *priv = nft_expr_priv(expr);
+#if IS_ENABLED(CONFIG_NF_TABLES_IPV6)
 	struct net *net = dev_net((pkt->in != NULL) ? pkt->in : pkt->out);
+#endif
 
 	switch (priv->type) {
 	case NFT_REJECT_ICMP_UNREACH:
Signature · 1 line
1.8.5.2
#2 lore raw
Quoted 7 lines · Eric Leblond

The 0-day testing from Fenguang Wu issued the following warning:
net/netfilter/nft_reject.c: In function 'nft_reject_eval':

Quoted 1 line
Quoted 1 line

net/netfilter/nft_reject.c:37:14: warning: unused variable 'net' [-Wunused-variable]

      struct net *net = dev_net((pkt->in != NULL) ? pkt->in : pkt->out);

This is due to the fact that if IPv6 is not build the variable is indeed unused.

Thanks Eric.

I sent this patch a bit earlier to address this:

http://patchwork.ozlabs.org/patch/307435/