netfilter: nfnetlink_queue: avoid harmless unnitialized variable warnings
Several ARM default configurations give us warnings on recent
compilers about potentially uninitialized variables in the
nfnetlink code in two functions:
net/netfilter/nfnetlink_queue.c: In function 'nfqnl_build_packet_message':
net/netfilter/nfnetlink_queue.c:519:19: warning: 'nfnl_ct' may be used uninitialized in this function [-Wmaybe-uninitialized]
if (ct && nfnl_ct->build(skb, ct, ctinfo, NFQA_CT, NFQA_CT_INFO) < 0)
Moving the rcu_dereference(nfnl_ct_hook) call outside of the
conditional code avoids the warning without forcing us to
preinitialize the variable.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: a4b4766c3c
("netfilter: nfnetlink_queue: rename related to nfqueue attaching conntrack info")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
This commit is contained in:
parent
4c6980462f
commit
8e662164ab
|
@ -365,8 +365,9 @@ nfqnl_build_packet_message(struct net *net, struct nfqnl_instance *queue,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nfnl_ct = rcu_dereference(nfnl_ct_hook);
|
||||||
|
|
||||||
if (queue->flags & NFQA_CFG_F_CONNTRACK) {
|
if (queue->flags & NFQA_CFG_F_CONNTRACK) {
|
||||||
nfnl_ct = rcu_dereference(nfnl_ct_hook);
|
|
||||||
if (nfnl_ct != NULL) {
|
if (nfnl_ct != NULL) {
|
||||||
ct = nfnl_ct->get_ct(entskb, &ctinfo);
|
ct = nfnl_ct->get_ct(entskb, &ctinfo);
|
||||||
if (ct != NULL)
|
if (ct != NULL)
|
||||||
|
@ -1064,9 +1065,10 @@ nfqnl_recv_verdict(struct sock *ctnl, struct sk_buff *skb,
|
||||||
if (entry == NULL)
|
if (entry == NULL)
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
|
||||||
|
/* rcu lock already held from nfnl->call_rcu. */
|
||||||
|
nfnl_ct = rcu_dereference(nfnl_ct_hook);
|
||||||
|
|
||||||
if (nfqa[NFQA_CT]) {
|
if (nfqa[NFQA_CT]) {
|
||||||
/* rcu lock already held from nfnl->call_rcu. */
|
|
||||||
nfnl_ct = rcu_dereference(nfnl_ct_hook);
|
|
||||||
if (nfnl_ct != NULL)
|
if (nfnl_ct != NULL)
|
||||||
ct = nfqnl_ct_parse(nfnl_ct, nlh, nfqa, entry, &ctinfo);
|
ct = nfqnl_ct_parse(nfnl_ct, nlh, nfqa, entry, &ctinfo);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue