Skip to contentSkip to conversation

warnings in current tree

DISCUSSION David Miller 2 participants 4 messages Apr 21, 2009 – Apr 22, 2009

Subsystems (2)
lore
Share & tools
lore

David Miller

author maintainer
#0 lore raw

Can someone fix these up? Thanks!

net/netfilter/nf_conntrack_netlink.c:1234: warning: 'helpname' may be used uninitialized in this function net/netfilter/nf_conntrack_netlink.c:991: warning: 'helpname' may be used uninitialized in this function

author maintainer
#1 lore raw

From: David Miller <[email protected]>
Date: Tue, 21 Apr 2009 01:43:57 -0700 (PDT)

Sorry, duh, meant netfilter-devel :-)

Quoted 8 lines

Can someone fix these up? Thanks!

net/netfilter/nf_conntrack_netlink.c:1234: warning: 'helpname' may be used uninitialized in this function net/netfilter/nf_conntrack_netlink.c:991: warning: 'helpname' may be used uninitialized in this function --
To unsubscribe from this list: send the line "unsubscribe netfilter" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw

Hi David!

Quoted 9 lines · David Miller

From: David Miller <[email protected]>
Date: Tue, 21 Apr 2009 01:43:57 -0700 (PDT)

Sorry, duh, meant netfilter-devel :-)

Quoted 4 lines

Can someone fix these up? Thanks!

net/netfilter/nf_conntrack_netlink.c:1234: warning: 'helpname' may be used uninitialized in this function net/netfilter/nf_conntrack_netlink.c:991: warning: 'helpname' may be used uninitialized in this function

Hm, weird, is this a "bogus punch"? I don't remember to have seen those here and that code has not been modified recently.

Anyway, patch attached :).

Signature · 1 line
"Los honestos son inadaptados sociales" -- Les Luthiers

netfilter: ctnetlink: fix gcc warning during compilation

From: Pablo Neira Ayuso <[email protected]>

This patch fixes a (bogus?) gcc warning during compilation:

net/netfilter/nf_conntrack_netlink.c:1234: warning: 'helpname' may be used uninitialized in this function net/netfilter/nf_conntrack_netlink.c:991: warning: 'helpname' may be used uninitialized in this function

In fact, helpname is initialized by ctnetlink_parse_help() so I cannot see a way to use it without being initialized.

---

 net/netfilter/nf_conntrack_netlink.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
net/netfilter/nf_conntrack_netlink.c +2 -2
index 0ea36e0..fcf6e3b 100644
@@ -988,7 +988,7 @@ ctnetlink_change_helper(struct nf_conn *ct, struct nlattr *cda[])
 {
 	struct nf_conntrack_helper *helper;
 	struct nf_conn_help *help = nfct_help(ct);
-	char *helpname;
+	char *helpname = NULL;
 	int err;
 
 	/* don't change helper of sibling connections */
@@ -1231,7 +1231,7 @@ ctnetlink_create_conntrack(struct nlattr *cda[],
 
 	rcu_read_lock();
  	if (cda[CTA_HELP]) {
- 		char *helpname;
+ 		char *helpname = NULL;
  
  		err = ctnetlink_parse_help(cda[CTA_HELP], &helpname);
  		if (err < 0)
author maintainer Applied
#3 lore raw

From: Pablo Neira Ayuso <[email protected]>
Date: Tue, 21 Apr 2009 12:54:06 +0200

Quoted 10 lines

Hi David!

Quoted 7 lines · David Miller

From: David Miller <[email protected]>
Date: Tue, 21 Apr 2009 01:43:57 -0700 (PDT)

Sorry, duh, meant netfilter-devel :-)

Quoted 2 lines

Can someone fix these up? Thanks!

Quoted 7 lines
Quoted 2 lines
Quoted 2 lines

net/netfilter/nf_conntrack_netlink.c:1234: warning: 'helpname' may be used uninitialized in this function net/netfilter/nf_conntrack_netlink.c:991: warning: 'helpname' may be used uninitialized in this function

Hm, weird, is this a "bogus punch"? I don't remember to have seen those here and that code has not been modified recently.

Anyway, patch attached :).

Applied, thanks :-)

The problem is when you pass the address of a local variable to a function, which is then inlined and has non-trivial control flow (as far as GCC is concerned), and this is the way the variable is initialized.