Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1266450

[PATCH] netfilter: nfnetlink_log: work around uninitialized variable warning

Path csiph.com!goblin3!goblin2!goblin.stu.neva.ru!aioe.org!bofh.it!news.nic.it!robomod
From Arnd Bergmann <arnd@arndb.de>
Newsgroups linux.kernel
Subject [PATCH] netfilter: nfnetlink_log: work around uninitialized variable warning
Date Tue, 10 Nov 2015 13:10:01 +0100
Message-ID <qtfUl-4Tt-5@gated-at.bofh.it> (permalink)
X-Original-To Pablo Neira Ayuso <pablo@netfilter.org>
User-Agent KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.5; x86_64; ; )
MIME-Version 1.0
Content-Transfer-Encoding 7Bit
Content-Type text/plain; charset="us-ascii"
X-Provags-ID V03:K0:rAUVO00w27ZmJqB23e0LyVYeCyHmBqKQiz9jhApcvMkMuo9lg7e LJtdflECt2Y28vlo2Sg3viHvsAbXQzhUUJ+9UIrMFGAszyyA5GYPm+ZA5dGWY3r+s9PMPpP vVKr2IDd+98Mhx5BxFrZNHCRuWaFT+dL5/koKRoA/SpT3iaZpYXHk8fIQYMteiJJjt57/Kw MikPeoNlvgd2lhCd1zHKQ==
X-Ui-Out-Filterresults notjunk:1;V01:K0:LXtFfZHq6NU=:8mQ7VrHh+RURdid+pU3acX ujuR7Bfa5DCBdkADBERVUXxg0Oat9MfS34mC7JqoCgFauX0PdxiUNFR2U4XsHfZFpJSztW36t /NVFTRWjIFpHzSxe5clTRlYO0NO+KQn7k7pO6tn8wkAS1iC4brudq/oe0qctbJXU1bzSikgWo dzPRpi/gNplF7FaytbMMymJ2NhrNa36o/AltfOyoytYNGV/i7OM1AeriVZ2teWScXZkrnPR4j xKTC05j//Y+bmn0xZnKE88ZKgCGXjvWS94uNFN8QoEp+eQFMgLhqXCBTTAu75XwCSew6asl17 YBlU8wQIbFJ/4saBQm6KRguU8G+BCmVEDKgH2FChQHAlA8cKK6afvqcDPj7HZtjq62ESG6FMt 0IOX6hF05kWmifPTd7pVG2GyoeQHrTgc/S6CkwcKpcdMi9eRJ9uSADVwEjCWID4TYSdwzmwBI b8wUDiY0S9fy+x2HVUohZbvSgtmdDS9WuZIlQkgc63wRq2xLSX5+Dl78Sg+lDIX16P62o2l7k l5oY4fmP6JxJDjyI2F67SuOOnUFm+xegoRGyzeYKH2Ac0wn/dS2oOfGYxO/khfFz9uSf/o3lk S8C/3/vN2LG9gM3Wgcsk0g5CNhQFgs6KyexsOOl+vSN+GNxf6qQthMVxV5EqWllKLUhrRiFrl WH8wNeSXY5Yc8l0Fo0C6/kDai931V5FyyNIsK2wK79PFgbIt4D8i3tARaqE4Nrt7vfWvN9cZ4 ySP1TpM0dMaepDTm
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 40
Organization linux.* mail to news gateway
X-Original-Cc Patrick McHardy <kaber@trash.net>, Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>, netfilter-devel@vger.kernel.org, coreteam@netfilter.org, netdev@vger.kernel.org, Ken-ichirou MATSUZAWA <chamaken@gmail.com>, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org
X-Original-Date Tue, 10 Nov 2015 13:08:15 +0100
X-Original-Message-ID <17817903.Md6b3ydRpX@wuerfel>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1266450

Show key headers only | View raw


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")
---

diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c
index 06eb48fceb42..740cce4685ac 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;

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

[PATCH] netfilter: nfnetlink_log: work around uninitialized variable warning Arnd Bergmann <arnd@arndb.de> - 2015-11-10 13:10 +0100
  Re: [PATCH] netfilter: nfnetlink_log: work around uninitialized  variable warning Pablo Neira Ayuso <pablo@netfilter.org> - 2015-11-11 14:20 +0100

csiph-web