Re: Linux v2.6.13-rc3

Alexey Dobriyan
2005-07-17T12:33:48Z

On Sun, Jul 17, 2005 at 01:18:54PM +0200, Borislav Petkov wrote:
> net/ipv4/netfilter/ip_conntrack_core.c: In function 'ip_conntrack_in':
> net/ipv4/netfilter/ip_conntrack_core.c:612: warning: 'set_reply' may be used
> uninitialized in this function

> --- net/ipv4/netfilter/ip_conntrack_core.c.orig
> +++ net/ipv4/netfilter/ip_conntrack_core.c
> @@ -609,7 +609,7 @@ unsigned int ip_conntrack_in(unsigned in

> - int set_reply;
> + int set_reply = 0;

> However, being so trivial, is it at all worth it fixing them

99% of "may be used uninitialized" warnings are bogus.

> or should I just ignore them?

You should ingnore them.
----------------------------------------------------------------------------
ip_conntrack_in(...)
{
int set_reply;

...
ct = resolve_normal_ct(*pskb, proto, &set_reply, hooknum, &ctinfo);
if (!ct) {
...
return NF_ACCEPT;
}
if (IS_ERR(ct)) {
...
return NF_DROP;
}
...
/* Will be reached if resolve_normal_ct() returns successfully */
if (set_reply)
set_bit(IPS_SEEN_REPLY_BIT, &ct->status);
}
----------------------------------------------------------------------------
Is it possible for resolve_normal_ct() to return successfully and not
touch set_reply?
----------------------------------------------------------------------------
struct ip_conntrack *resolve_normal_ct(..., int set_reply, ...)
{
...
if (!ip_ct_get_tuple(skb->nh.iph, skb, skb->nh.iph->ihl*4,
&tuple, proto))
return NULL;
h = ip_conntrack_find_get(&tuple, NULL);
if (!h) {
h = init_conntrack(&tuple, proto, skb);
if (!h)
return NULL;
if (IS_ERR(h))
return (void *)h;
}
/* h is valid from now */
ct = tuplehash_to_ctrack(h);
/* ct is valid from now */
if (DIRECTION(h) == IP_CT_DIR_REPLY) {
...
*set_reply = 1;
} else {
...
*set_reply = 0;
}
/* set_reply is initialized */
...
return ct;
}
----------------------------------------------------------------------------