netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] netfilter: nat: avoid unused-variable warning
@ 2019-03-25 13:53 Arnd Bergmann
  2019-04-30 12:31 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2019-03-25 13:53 UTC (permalink / raw)
  To: Pablo Neira Ayuso, Jozsef Kadlecsik, Florian Westphal, David S. Miller
  Cc: Arnd Bergmann, netfilter-devel, coreteam, netdev, linux-kernel

masq_refcnt6 was added at the start of the file, but it is
only used in the option IPv6 section of the file, causing
a harmless compiler warning if IPv6 is disabled:

net/netfilter/nf_nat_masquerade.c:15:21: error: 'masq_refcnt6' defined but not used [-Werror=unused-variable]
 static unsigned int masq_refcnt6 __read_mostly;

Move the variable next to the user to avoid that warning.

Fixes: 46f7487e161b ("netfilter: nat: don't register device notifier twice")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
----
This is an older patch stack, for some reason I seem to have never
sent it, and I can't find any indication of anyone else sending
a similar fix, so sending this out now.

If it's already fixed upstream, please ignore.
---
 net/netfilter/nf_nat_masquerade.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/netfilter/nf_nat_masquerade.c b/net/netfilter/nf_nat_masquerade.c
index d85c4d902e7b..878a73b4f65c 100644
--- a/net/netfilter/nf_nat_masquerade.c
+++ b/net/netfilter/nf_nat_masquerade.c
@@ -12,7 +12,6 @@
 
 static DEFINE_MUTEX(masq_mutex);
 static unsigned int masq_refcnt4 __read_mostly;
-static unsigned int masq_refcnt6 __read_mostly;
 
 unsigned int
 nf_nat_masquerade_ipv4(struct sk_buff *skb, unsigned int hooknum,
@@ -322,6 +321,8 @@ static struct notifier_block masq_inet6_notifier = {
 	.notifier_call	= masq_inet6_event,
 };
 
+static unsigned int masq_refcnt6 __read_mostly;
+
 int nf_nat_masquerade_ipv6_register_notifier(void)
 {
 	int ret = 0;
-- 
2.20.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] netfilter: nat: avoid unused-variable warning
  2019-03-25 13:53 [PATCH] netfilter: nat: avoid unused-variable warning Arnd Bergmann
@ 2019-04-30 12:31 ` Pablo Neira Ayuso
  0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2019-04-30 12:31 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Jozsef Kadlecsik, Florian Westphal, David S. Miller,
	netfilter-devel, coreteam, netdev, linux-kernel

On Mon, Mar 25, 2019 at 02:53:05PM +0100, Arnd Bergmann wrote:
> masq_refcnt6 was added at the start of the file, but it is
> only used in the option IPv6 section of the file, causing
> a harmless compiler warning if IPv6 is disabled:
> 
> net/netfilter/nf_nat_masquerade.c:15:21: error: 'masq_refcnt6' defined but not used [-Werror=unused-variable]
>  static unsigned int masq_refcnt6 __read_mostly;
> 
> Move the variable next to the user to avoid that warning.
> 
> Fixes: 46f7487e161b ("netfilter: nat: don't register device notifier twice")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ----
> This is an older patch stack, for some reason I seem to have never
> sent it, and I can't find any indication of anyone else sending
> a similar fix, so sending this out now.
> 
> If it's already fixed upstream, please ignore.

Yes, Florian fixed this in nf-next.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-04-30 12:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-25 13:53 [PATCH] netfilter: nat: avoid unused-variable warning Arnd Bergmann
2019-04-30 12:31 ` Pablo Neira Ayuso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).