netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [net-next:master 90/102] net/ipv4/route.c:1283:9: warning: unused variable 'saddr'
@ 2012-07-12 14:34 Fengguang Wu
  2012-07-12 14:40 ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Fengguang Wu @ 2012-07-12 14:34 UTC (permalink / raw)
  To: David S. Miller; +Cc: kernel-janitors, netdev

Hi David,

There are new compile warnings show up in

tree:   git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git master
head:   3ec5a261aef55a32664bffd335e5c32aeadf3215
commit: e47a185b31dd2acd424fac7dc0efb96fc5b31a33 [90/102] ipv4: Generalize ip_do_redirect() and hook into new dst_ops->redirect.

All warnings:

net/ipv4/route.c: In function 'ip_do_redirect':
net/ipv4/route.c:1283:9: warning: unused variable 'saddr' [-Wunused-variable]
net/ipv4/route.c:1282:9: warning: unused variable 'daddr' [-Wunused-variable]

vim +1283 net/ipv4/route.c
  1280		__be32 old_gw = ip_hdr(skb)->saddr;
  1281		struct net_device *dev = skb->dev;
  1282		__be32 daddr = iph->daddr;
> 1283		__be32 saddr = iph->saddr;
  1284		struct in_device *in_dev;
  1285		struct neighbour *n;
  1286		struct rtable *rt;

..because the saddr/daddr variables are used inside

#ifdef CONFIG_IP_ROUTE_VERBOSE
        if (IN_DEV_LOG_MARTIANS(in_dev))
                net_info_ratelimited("Redirect from %pI4 on %s about %pI4 ignored\n"
                                     "  Advised path = %pI4 -> %pI4\n",
                                     &old_gw, dev->name, &new_gw,
                                     &saddr, &daddr);
#endif

---
0-DAY kernel build testing backend         Open Source Technology Centre
Fengguang Wu <wfg@linux.intel.com>                     Intel Corporation

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [net-next:master 90/102] net/ipv4/route.c:1283:9: warning: unused variable 'saddr'
  2012-07-12 14:34 [net-next:master 90/102] net/ipv4/route.c:1283:9: warning: unused variable 'saddr' Fengguang Wu
@ 2012-07-12 14:40 ` David Miller
  2012-07-12 14:54   ` Fengguang Wu
  2012-07-12 15:47   ` Dan Carpenter
  0 siblings, 2 replies; 4+ messages in thread
From: David Miller @ 2012-07-12 14:40 UTC (permalink / raw)
  To: fengguang.wu; +Cc: kernel-janitors, netdev


There's not need to report these to kernel-janitors if it's a
net-next specific issue and I'm going to fix it up 5 minutes
after you report it.

====================
[PATCH] ipv4: Fix warnings in ip_do_redirect() for some configurations.

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
---
 net/ipv4/route.c |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 23bbe29..9319bf1 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -1275,12 +1275,9 @@ static void rt_del(unsigned int hash, struct rtable *rt)
 
 static void ip_do_redirect(struct dst_entry *dst, struct sk_buff *skb)
 {
-	const struct iphdr *iph = (const struct iphdr *) skb->data;
 	__be32 new_gw = icmp_hdr(skb)->un.gateway;
 	__be32 old_gw = ip_hdr(skb)->saddr;
 	struct net_device *dev = skb->dev;
-	__be32 daddr = iph->daddr;
-	__be32 saddr = iph->saddr;
 	struct in_device *in_dev;
 	struct neighbour *n;
 	struct rtable *rt;
@@ -1336,11 +1333,16 @@ static void ip_do_redirect(struct dst_entry *dst, struct sk_buff *skb)
 
 reject_redirect:
 #ifdef CONFIG_IP_ROUTE_VERBOSE
-	if (IN_DEV_LOG_MARTIANS(in_dev))
+	if (IN_DEV_LOG_MARTIANS(in_dev)) {
+		const struct iphdr *iph = (const struct iphdr *) skb->data;
+		__be32 daddr = iph->daddr;
+		__be32 saddr = iph->saddr;
+
 		net_info_ratelimited("Redirect from %pI4 on %s about %pI4 ignored\n"
 				     "  Advised path = %pI4 -> %pI4\n",
 				     &old_gw, dev->name, &new_gw,
 				     &saddr, &daddr);
+	}
 #endif
 	;
 }
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [net-next:master 90/102] net/ipv4/route.c:1283:9: warning: unused variable 'saddr'
  2012-07-12 14:40 ` David Miller
@ 2012-07-12 14:54   ` Fengguang Wu
  2012-07-12 15:47   ` Dan Carpenter
  1 sibling, 0 replies; 4+ messages in thread
From: Fengguang Wu @ 2012-07-12 14:54 UTC (permalink / raw)
  To: David Miller; +Cc: kernel-janitors, netdev

OK!

On Thu, Jul 12, 2012 at 07:40:58AM -0700, David Miller wrote:
> 
> There's not need to report these to kernel-janitors if it's a
> net-next specific issue and I'm going to fix it up 5 minutes
> after you report it.
> 
> ====================
> [PATCH] ipv4: Fix warnings in ip_do_redirect() for some configurations.
> 
> Reported-by: Fengguang Wu <fengguang.wu@intel.com>
> Signed-off-by: David S. Miller <davem@davemloft.net>
> ---
>  net/ipv4/route.c |   10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/net/ipv4/route.c b/net/ipv4/route.c
> index 23bbe29..9319bf1 100644
> --- a/net/ipv4/route.c
> +++ b/net/ipv4/route.c
> @@ -1275,12 +1275,9 @@ static void rt_del(unsigned int hash, struct rtable *rt)
>  
>  static void ip_do_redirect(struct dst_entry *dst, struct sk_buff *skb)
>  {
> -	const struct iphdr *iph = (const struct iphdr *) skb->data;
>  	__be32 new_gw = icmp_hdr(skb)->un.gateway;
>  	__be32 old_gw = ip_hdr(skb)->saddr;
>  	struct net_device *dev = skb->dev;
> -	__be32 daddr = iph->daddr;
> -	__be32 saddr = iph->saddr;
>  	struct in_device *in_dev;
>  	struct neighbour *n;
>  	struct rtable *rt;
> @@ -1336,11 +1333,16 @@ static void ip_do_redirect(struct dst_entry *dst, struct sk_buff *skb)
>  
>  reject_redirect:
>  #ifdef CONFIG_IP_ROUTE_VERBOSE
> -	if (IN_DEV_LOG_MARTIANS(in_dev))
> +	if (IN_DEV_LOG_MARTIANS(in_dev)) {
> +		const struct iphdr *iph = (const struct iphdr *) skb->data;
> +		__be32 daddr = iph->daddr;
> +		__be32 saddr = iph->saddr;
> +
>  		net_info_ratelimited("Redirect from %pI4 on %s about %pI4 ignored\n"
>  				     "  Advised path = %pI4 -> %pI4\n",
>  				     &old_gw, dev->name, &new_gw,
>  				     &saddr, &daddr);
> +	}
>  #endif
>  	;
>  }
> -- 
> 1.7.10.4

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [net-next:master 90/102] net/ipv4/route.c:1283:9: warning: unused variable 'saddr'
  2012-07-12 14:40 ` David Miller
  2012-07-12 14:54   ` Fengguang Wu
@ 2012-07-12 15:47   ` Dan Carpenter
  1 sibling, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2012-07-12 15:47 UTC (permalink / raw)
  To: David Miller; +Cc: fengguang.wu, kernel-janitors, netdev

On Thu, Jul 12, 2012 at 07:40:58AM -0700, David Miller wrote:
> 
> There's not need to report these to kernel-janitors if it's a
> net-next specific issue and I'm going to fix it up 5 minutes
> after you report it.

The kernel-janitors list is CC'd to prevent people from sending
duplicate messages.  This has happened in the past and it's
annoying for everyone.

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-07-12 15:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-12 14:34 [net-next:master 90/102] net/ipv4/route.c:1283:9: warning: unused variable 'saddr' Fengguang Wu
2012-07-12 14:40 ` David Miller
2012-07-12 14:54   ` Fengguang Wu
2012-07-12 15:47   ` Dan Carpenter

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).