From: Michael Wang <yun.wang@profitbricks.com>
To: Borislav Petkov <bp@alien8.de>, Pablo Neira Ayuso <pablo@netfilter.org>
Cc: netfilter-devel@vger.kernel.org, lkml <linux-kernel@vger.kernel.org>
Subject: Re: nfnetlink warnings
Date: Mon, 23 Nov 2015 10:49:34 +0100 [thread overview]
Message-ID: <5652E12E.3070500@profitbricks.com> (raw)
In-Reply-To: <20151123093607.GA5134@pd.tnic>
Hi, Borislav
Why not just initialized it as NULL, or mark it as uninitialized_var()?
Regards,
Michael Wang
On 11/23/2015 10:36 AM, Borislav Petkov wrote:
> Hey,
>
> so I keep getting those since recently:
>
> 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)
> ^
> net/netfilter/nfnetlink_queue.c:316:23: note: ‘nfnl_ct’ was declared here
> struct nfnl_ct_hook *nfnl_ct;
> ^
> net/netfilter/nfnetlink_queue.c: In function ‘nfqnl_recv_verdict’:
> net/netfilter/nfnetlink_queue.c:1083:11: warning: ‘nfnl_ct’ may be used uninitialized in this function [-Wmaybe-uninitialized]
> nfnl_ct->seq_adjust(entry->skb, ct, ctinfo, diff);
> ^
>
> and was thinking can we shut them up like this? I know, it is ugly :-\
>
> I mean, it is obvious in both cases that nfnl_ct won't be used if ct is
> not set but apparently gcc can't see that far...
>
> ---
> diff --git a/net/netfilter/nfnetlink_queue.c b/net/netfilter/nfnetlink_queue.c
> index 7d81d280cb4f..cd61b0b5c413 100644
> --- a/net/netfilter/nfnetlink_queue.c
> +++ b/net/netfilter/nfnetlink_queue.c
> @@ -372,6 +372,8 @@ nfqnl_build_packet_message(struct net *net, struct nfqnl_instance *queue,
> if (ct != NULL)
> size += nfnl_ct->build_size(ct);
> }
> + } else {
> + nfnl_ct = NULL;
> }
>
> if (queue->flags & NFQA_CFG_F_UID_GID) {
> @@ -1069,6 +1071,8 @@ nfqnl_recv_verdict(struct sock *ctnl, struct sk_buff *skb,
> nfnl_ct = rcu_dereference(nfnl_ct_hook);
> if (nfnl_ct != NULL)
> ct = nfqnl_ct_parse(nfnl_ct, nlh, nfqa, entry, &ctinfo);
> + } else {
> + nfnl_ct = NULL;
> }
>
> if (nfqa[NFQA_PAYLOAD]) {
>
next prev parent reply other threads:[~2015-11-23 9:49 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-23 9:36 Borislav Petkov
2015-11-23 9:49 ` Michael Wang [this message]
2015-11-23 9:54 ` Borislav Petkov
2015-11-23 10:20 ` Michael Wang
2015-11-23 10:30 ` Pablo Neira Ayuso
2015-11-23 10:32 ` Borislav Petkov
2015-11-23 10:36 ` Michael Wang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5652E12E.3070500@profitbricks.com \
--to=yun.wang@profitbricks.com \
--cc=bp@alien8.de \
--cc=linux-kernel@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®