All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Cc: davem@davemloft.net, netdev@vger.kernel.org
Subject: [PATCH 07/10] netfilter: nfnetlink_log: work around uninitialized variable warning
Date: Wed, 11 Nov 2015 18:33:40 +0100	[thread overview]
Message-ID: <1447263223-22662-8-git-send-email-pablo@netfilter.org> (raw)
In-Reply-To: <1447263223-22662-1-git-send-email-pablo@netfilter.org>

From: Arnd Bergmann <arnd@arndb.de>

After a recent (correct) change, gcc started warning about the use
of the 'flags' variable in nfulnl_recv_config()

net/netfilter/nfnetlink_log.c: In function 'nfulnl_recv_config':
net/netfilter/nfnetlink_log.c:320:14: warning: 'flags' may be used uninitialized in this function [-Wmaybe-uninitialized]
net/netfilter/nfnetlink_log.c:828:6: note: 'flags' was declared here

The warning first shows up in ARM s3c2410_defconfig with gcc-4.3 or
higher (including 5.2.1, which is the latest version I checked) I
tried working around it by rearranging the code but had no success
with that.

As a last resort, this initializes the variable to zero, which shuts
up the warning, but means that we don't get a warning if the code
is ever changed in a way that actually causes the variable to be
used without first being written.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 8cbc870829ec ("netfilter: nfnetlink_log: validate dependencies to avoid breaking atomicity")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 net/netfilter/nfnetlink_log.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c
index 06eb48f..740cce4 100644
--- a/net/netfilter/nfnetlink_log.c
+++ b/net/netfilter/nfnetlink_log.c
@@ -825,7 +825,7 @@ nfulnl_recv_config(struct sock *ctnl, struct sk_buff *skb,
 	struct net *net = sock_net(ctnl);
 	struct nfnl_log_net *log = nfnl_log_pernet(net);
 	int ret = 0;
-	u16 flags;
+	u16 flags = 0;
 
 	if (nfula[NFULA_CFG_CMD]) {
 		u_int8_t pf = nfmsg->nfgen_family;
-- 
2.1.4

  parent reply	other threads:[~2015-11-11 17:33 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-11 17:33 [PATCH 00/10] Netfilter fixes for net Pablo Neira Ayuso
2015-11-11 17:33 ` [PATCH 01/10] netfilter: ingress: don't use nf_hook_list_active Pablo Neira Ayuso
2015-11-11 17:33 ` [PATCH 02/10] netfilter: ingress: fix wrong input interface on hook Pablo Neira Ayuso
2015-11-11 17:33 ` [PATCH 03/10] netfilter: ipset: Fix extension alignment Pablo Neira Ayuso
2015-11-11 17:33 ` [PATCH 04/10] netfilter: ipset: Fix hash:* type expiration Pablo Neira Ayuso
2015-11-11 17:33 ` [PATCH 05/10] netfilter: ipset: Fix hash type expire: release empty hash bucket block Pablo Neira Ayuso
2015-11-11 17:33 ` [PATCH 06/10] netfilter: Fix removal of GRE expectation entries created by PPTP Pablo Neira Ayuso
2015-11-11 17:33 ` Pablo Neira Ayuso [this message]
2015-11-11 17:33 ` [PATCH 08/10] netfilter: fix xt_TEE and xt_TPROXY dependencies Pablo Neira Ayuso
2015-11-11 17:33 ` [PATCH 09/10] net: add __netdev_alloc_pcpu_stats() to indicate gfp flags Pablo Neira Ayuso
2015-11-11 17:33 ` [PATCH 10/10] netfilter: nf_tables: add clone interface to expression operations Pablo Neira Ayuso
2015-11-12 19:20 ` [PATCH 00/10] Netfilter fixes for net David Miller
2015-11-13 17:58 ` Josh Boyer
2015-11-13 18:52   ` Jozsef Kadlecsik

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=1447263223-22662-8-git-send-email-pablo@netfilter.org \
    --to=pablo@netfilter.org \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.