]> git.baikalelectronics.ru Git - kernel.git/commitdiff
netfilter: conntrack: remove uninitialized shadow variable
authorArnd Bergmann <arnd@arndb.de>
Mon, 9 May 2016 19:47:23 +0000 (21:47 +0200)
committerDavid S. Miller <davem@davemloft.net>
Tue, 10 May 2016 05:04:04 +0000 (01:04 -0400)
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: 862c8d4614d8 ("netfilter: conntrack: introduce clash resolution on insertion race")
Acked-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/netfilter/nf_conntrack_core.c

index 0cd29365004f2562caf233c437b1fa469d487aff..566c64e3ec50be4a1340a45bc2b9ea756197912b 100644 (file)
@@ -626,7 +626,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. */