* [PATCH] netfilter: conntrack: remove uninitialized shadow variable
@ 2016-05-09 19:47 Arnd Bergmann
2016-05-09 20:01 ` Pablo Neira Ayuso
2016-05-10 5:04 ` David Miller
0 siblings, 2 replies; 4+ messages in thread
From: Arnd Bergmann @ 2016-05-09 19:47 UTC (permalink / raw)
To: Pablo Neira Ayuso, Patrick McHardy, Jozsef Kadlecsik, David S. Miller
Cc: Arnd Bergmann, Florian Westphal, Daniel Borkmann, Sasha Levin,
netfilter-devel, coreteam, netdev, linux-kernel
A recent commit introduced an unconditional use of an uninitialized
variable, as reported in this gcc warning:
net/netfilter/nf_conntrack_core.c: In function '__nf_conntrack_confirm':
net/netfilter/nf_conntrack_core.c:632:33: error: 'ctinfo' may be used uninitialized in this function [-Werror=maybe-uninitialized]
bytes = atomic64_read(&counter[CTINFO2DIR(ctinfo)].bytes);
^
net/netfilter/nf_conntrack_core.c:628:26: note: 'ctinfo' was declared here
enum ip_conntrack_info ctinfo;
The problem is that a local variable shadows the function parameter.
This removes the local variable, which looks like what Pablo originally
intended.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 71d8c47fc653 ("netfilter: conntrack: introduce clash resolution on insertion race")
---
net/netfilter/nf_conntrack_core.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
index f58a70410c69..157ffa667395 100644
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -625,7 +625,6 @@ static void nf_ct_acct_merge(struct nf_conn *ct, enum ip_conntrack_info ctinfo,
acct = nf_conn_acct_find(loser_ct);
if (acct) {
struct nf_conn_counter *counter = acct->counter;
- enum ip_conntrack_info ctinfo;
unsigned int bytes;
/* u32 should be fine since we must have seen one packet. */
--
2.7.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] netfilter: conntrack: remove uninitialized shadow variable
2016-05-09 19:47 [PATCH] netfilter: conntrack: remove uninitialized shadow variable Arnd Bergmann
@ 2016-05-09 20:01 ` Pablo Neira Ayuso
2016-05-09 20:12 ` Arnd Bergmann
2016-05-10 5:04 ` David Miller
1 sibling, 1 reply; 4+ messages in thread
From: Pablo Neira Ayuso @ 2016-05-09 20:01 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Patrick McHardy, Jozsef Kadlecsik, David S. Miller,
Florian Westphal, Daniel Borkmann, Sasha Levin, netfilter-devel,
coreteam, netdev, linux-kernel
On Mon, May 09, 2016 at 09:47:23PM +0200, Arnd Bergmann wrote:
> A recent commit introduced an unconditional use of an uninitialized
> variable, as reported in this gcc warning:
>
> net/netfilter/nf_conntrack_core.c: In function '__nf_conntrack_confirm':
> net/netfilter/nf_conntrack_core.c:632:33: error: 'ctinfo' may be used uninitialized in this function [-Werror=maybe-uninitialized]
> bytes = atomic64_read(&counter[CTINFO2DIR(ctinfo)].bytes);
> ^
> net/netfilter/nf_conntrack_core.c:628:26: note: 'ctinfo' was declared here
> enum ip_conntrack_info ctinfo;
>
> The problem is that a local variable shadows the function parameter.
> This removes the local variable, which looks like what Pablo originally
> intended.
Acked-by: Pablo Neira Ayuso <pablo@netfilter.org>
Sorry for this, I wonder why gcc didn't catch up this here.
@David, you can integrate this into your net-next tree.
Thanks for fixing up this Arnd.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] netfilter: conntrack: remove uninitialized shadow variable
2016-05-09 20:01 ` Pablo Neira Ayuso
@ 2016-05-09 20:12 ` Arnd Bergmann
0 siblings, 0 replies; 4+ messages in thread
From: Arnd Bergmann @ 2016-05-09 20:12 UTC (permalink / raw)
To: Pablo Neira Ayuso
Cc: Patrick McHardy, Jozsef Kadlecsik, David S. Miller,
Florian Westphal, Daniel Borkmann, Sasha Levin, netfilter-devel,
coreteam, netdev, linux-kernel
On Monday 09 May 2016 22:01:17 Pablo Neira Ayuso wrote:
> On Mon, May 09, 2016 at 09:47:23PM +0200, Arnd Bergmann wrote:
> > A recent commit introduced an unconditional use of an uninitialized
> > variable, as reported in this gcc warning:
> >
> > net/netfilter/nf_conntrack_core.c: In function '__nf_conntrack_confirm':
> > net/netfilter/nf_conntrack_core.c:632:33: error: 'ctinfo' may be used uninitialized in this function [-Werror=maybe-uninitialized]
> > bytes = atomic64_read(&counter[CTINFO2DIR(ctinfo)].bytes);
> > ^
> > net/netfilter/nf_conntrack_core.c:628:26: note: 'ctinfo' was declared here
> > enum ip_conntrack_info ctinfo;
> >
> > The problem is that a local variable shadows the function parameter.
> > This removes the local variable, which looks like what Pablo originally
> > intended.
>
> Acked-by: Pablo Neira Ayuso <pablo@netfilter.org>
>
> Sorry for this, I wonder why gcc didn't catch up this here.
>
> @David, you can integrate this into your net-next tree.
>
> Thanks for fixing up this Arnd.
By default, an allmodconfig build will hide these warnings because of
excessive false positives from CONFIG_CC_OPTIMIZE_FOR_SIZE. I've
tried twice to get a patch merged that disables CONFIG_CC_OPTIMIZE_FOR_SIZE
in allmodconfig so we get better warnings, but that patch unfortunately
got ignored.
Arnd
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] netfilter: conntrack: remove uninitialized shadow variable
2016-05-09 19:47 [PATCH] netfilter: conntrack: remove uninitialized shadow variable Arnd Bergmann
2016-05-09 20:01 ` Pablo Neira Ayuso
@ 2016-05-10 5:04 ` David Miller
1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2016-05-10 5:04 UTC (permalink / raw)
To: arnd
Cc: pablo, kaber, kadlec, fw, daniel, sasha.levin, netfilter-devel,
coreteam, netdev, linux-kernel
From: Arnd Bergmann <arnd@arndb.de>
Date: Mon, 9 May 2016 21:47:23 +0200
> A recent commit introduced an unconditional use of an uninitialized
> variable, as reported in this gcc warning:
>
> net/netfilter/nf_conntrack_core.c: In function '__nf_conntrack_confirm':
> net/netfilter/nf_conntrack_core.c:632:33: error: 'ctinfo' may be used uninitialized in this function [-Werror=maybe-uninitialized]
> bytes = atomic64_read(&counter[CTINFO2DIR(ctinfo)].bytes);
> ^
> net/netfilter/nf_conntrack_core.c:628:26: note: 'ctinfo' was declared here
> enum ip_conntrack_info ctinfo;
>
> The problem is that a local variable shadows the function parameter.
> This removes the local variable, which looks like what Pablo originally
> intended.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Fixes: 71d8c47fc653 ("netfilter: conntrack: introduce clash resolution on insertion race")
Applied.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-05-10 5:04 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-09 19:47 [PATCH] netfilter: conntrack: remove uninitialized shadow variable Arnd Bergmann
2016-05-09 20:01 ` Pablo Neira Ayuso
2016-05-09 20:12 ` Arnd Bergmann
2016-05-10 5:04 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).