[PATCH] netfilter: nftables: fix warning in nft_reject

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The 0-day testing from Fenguang Wu issued the following warning:
 net/netfilter/nft_reject.c: In function 'nft_reject_eval':
 >> 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.

Reported-by: Fengguang Wu <fengguang.wu@xxxxxxxxx>
Signed-off-by: Eric Leblond <eric@xxxxxxxxx>
---
 net/netfilter/nft_reject.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/netfilter/nft_reject.c b/net/netfilter/nft_reject.c
index 0d690d4..c65fbd8 100644
--- a/net/netfilter/nft_reject.c
+++ b/net/netfilter/nft_reject.c
@@ -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:
-- 
1.8.5.2

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux