netfilter: synproxy: fix nf_synproxy_ipv{4,6}_init() return code
Subsystems (3)
PATCH 1/1 netfilter: synproxy: fix nf_synproxy_ipv{4,6}_init() return code
We return an uninitialized variable on success:
net/netfilter/nf_synproxy_core.c:793:6: error: variable 'err' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
if (snet->hook_ref4 == 0) {
^~~~~~~~~~~~~~~~~~~~Initialize the return code to zero first.
Fixes d7f9b2f18eae ("netfilter: synproxy: extract SYNPROXY infrastructure from {ipt, ip6t}_SYNPROXY")
Signed-off-by Arnd Bergmann <[email protected]>
--- net/netfilter/nf_synproxy_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/netfilter/nf_synproxy_core.c +2 -2
@@ -788,7 +788,7 @@ static const struct nf_hook_ops ipv4_synproxy_ops[] = {int nf_synproxy_ipv4_init (struct synproxy_net *snet,struct net *net) { -int err; +int err =0 ;if (snet->hook_ref4 ==0 ) { err = nf_register_net_hooks(net, ipv4_synproxy_ops,
@@ -1213,7 +1213,7 @@ static const struct nf_hook_ops ipv6_synproxy_ops[] = {int nf_synproxy_ipv6_init (struct synproxy_net *snet,struct net *net) { -int err; +int err =0 ;if (snet->hook_ref6 ==0 ) { err = nf_register_net_hooks(net, ipv6_synproxy_ops,
Signature · 1 line
2.20.0
Pablo Neira Ayuso
maintainerQuoted 7 lines · Arnd Bergmann
We return an uninitialized variable on success:
net/netfilter/nf_synproxy_core.c:793:6: error: variable 'err' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]if (snet->hook_ref4 == 0) { ^~~~~~~~~~~~~~~~~~~~Initialize the return code to zero first.
Thanks Arnd. We got a fix for this: