Skip to contentSkip to conversation

net/netfilter/nf_nat_proto.c - make tables static

PATCH Applied Valdis Klētnieks 3 participants 3 messages Aug 8, 2019 – Aug 13, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/netfilter/nf_nat_proto.c - make tables static

Sparse warns about two tables not being declared.

CHECK net/netfilter/nf_nat_proto.c
net/netfilter/nf_nat_proto.c:725:26: warning: symbol 'nf_nat_ipv4_ops' was not declared. Should it be static? net/netfilter/nf_nat_proto.c:964:26: warning: symbol 'nf_nat_ipv6_ops' was not declared. Should it be static?

And in fact they can indeed be static.

net/netfilter/nf_nat_proto.c +2 -2
index 7ac733ebd060..0a59c14b5177 100644
@@ -722,7 +722,7 @@ nf_nat_ipv4_local_fn(void *priv, struct sk_buff *skb,
 	return ret;
 }
 
-const struct nf_hook_ops nf_nat_ipv4_ops[] = {
+static const struct nf_hook_ops nf_nat_ipv4_ops[] = {
 	/* Before packet filtering, change destination */
 	{
 		.hook		= nf_nat_ipv4_in,
@@ -961,7 +961,7 @@ nf_nat_ipv6_local_fn(void *priv, struct sk_buff *skb,
 	return ret;
 }
 
-const struct nf_hook_ops nf_nat_ipv6_ops[] = {
+static const struct nf_hook_ops nf_nat_ipv6_ops[] = {
 	/* Before packet filtering, change destination */
 	{
 		.hook		= nf_nat_ipv6_in,
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · Valdis Klētnieks

Sparse warns about two tables not being declared.

CHECK net/netfilter/nf_nat_proto.c
net/netfilter/nf_nat_proto.c:725:26: warning: symbol 'nf_nat_ipv4_ops' was not declared. Should it be static? net/netfilter/nf_nat_proto.c:964:26: warning: symbol 'nf_nat_ipv6_ops' was not declared. Should it be static?

And in fact they can indeed be static.

Seems i removed the static qualifier when i added inet nat support, but the patch that was merged doesn't use them outside of nf_nat_proto.c.

Thanks for fixing this.

maintainer Applied
#2 lore raw
In reply to Valdis Klētnieks
Quoted 7 lines · Valdis Klētnieks

Sparse warns about two tables not being declared.

CHECK net/netfilter/nf_nat_proto.c
net/netfilter/nf_nat_proto.c:725:26: warning: symbol 'nf_nat_ipv4_ops' was not declared. Should it be static? net/netfilter/nf_nat_proto.c:964:26: warning: symbol 'nf_nat_ipv6_ops' was not declared. Should it be static?

And in fact they can indeed be static.

Applied, thanks.