netfilter: ipt_CLUSTERIP: fix warning unused variable cn

Message ID 20190123114811.25388-1-anders.roxell@linaro.org
State Accepted
Commit 206b8cc514d7ff2b79dd2d5ad939adc7c493f07a
Headers show
Series
  • netfilter: ipt_CLUSTERIP: fix warning unused variable cn
Related show

Commit Message

Anders Roxell Jan. 23, 2019, 11:48 a.m.
When CONFIG_PROC_FS isn't set the variable cn isn't used.

net/ipv4/netfilter/ipt_CLUSTERIP.c: In function ‘clusterip_net_exit’:
net/ipv4/netfilter/ipt_CLUSTERIP.c:849:24: warning: unused variable ‘cn’ [-Wunused-variable]
  struct clusterip_net *cn = clusterip_pernet(net);
                        ^~

Rework so the variable 'cn' is declared inside "#ifdef CONFIG_PROC_FS".

Fixes: b12f7bad5ad3 ("netfilter: ipt_CLUSTERIP: remove wrong WARN_ON_ONCE in netns exit routine")
Signed-off-by: Anders Roxell <anders.roxell@linaro.org>

---
 net/ipv4/netfilter/ipt_CLUSTERIP.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.19.2

Comments

Pablo Neira Ayuso Jan. 28, 2019, 9:51 a.m. | #1
On Wed, Jan 23, 2019 at 12:48:11PM +0100, Anders Roxell wrote:
> When CONFIG_PROC_FS isn't set the variable cn isn't used.

> 

> net/ipv4/netfilter/ipt_CLUSTERIP.c: In function ‘clusterip_net_exit’:

> net/ipv4/netfilter/ipt_CLUSTERIP.c:849:24: warning: unused variable ‘cn’ [-Wunused-variable]

>   struct clusterip_net *cn = clusterip_pernet(net);

>                         ^~

> 

> Rework so the variable 'cn' is declared inside "#ifdef CONFIG_PROC_FS".


Applied, thanks.

Patch

diff --git a/net/ipv4/netfilter/ipt_CLUSTERIP.c b/net/ipv4/netfilter/ipt_CLUSTERIP.c
index b61977db9b7f..2a909e5f9ba0 100644
--- a/net/ipv4/netfilter/ipt_CLUSTERIP.c
+++ b/net/ipv4/netfilter/ipt_CLUSTERIP.c
@@ -846,9 +846,9 @@  static int clusterip_net_init(struct net *net)
 
 static void clusterip_net_exit(struct net *net)
 {
+#ifdef CONFIG_PROC_FS
 	struct clusterip_net *cn = clusterip_pernet(net);
 
-#ifdef CONFIG_PROC_FS
 	mutex_lock(&cn->mutex);
 	proc_remove(cn->procdir);
 	cn->procdir = NULL;