ipv4: Fix 'iph' use before set.
authorDavid S. Miller <davem@davemloft.net>
Fri, 13 May 2011 03:03:46 +0000 (23:03 -0400)
committerDavid S. Miller <davem@davemloft.net>
Fri, 13 May 2011 03:03:46 +0000 (23:03 -0400)
I swear none of my compilers warned about this, yet it is so
obvious.

> net/ipv4/ip_forward.c: In function 'ip_forward':
> net/ipv4/ip_forward.c:87: warning: 'iph' may be used uninitialized in this function

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/ip_forward.c

index fcbc0c8f12617e8cd19316f8d24bbde4d5dec52f..3b34d1c862709e7bde3cd3665fad1e191692506d 100644 (file)
@@ -84,7 +84,7 @@ int ip_forward(struct sk_buff *skb)
 
        rt = skb_rtable(skb);
 
-       if (opt->is_strictroute && iph->daddr != rt->rt_gateway)
+       if (opt->is_strictroute && ip_hdr(skb)->daddr != rt->rt_gateway)
                goto sr_failed;
 
        if (unlikely(skb->len > dst_mtu(&rt->dst) && !skb_is_gso(skb) &&