netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] vxlan: Refactor vxlan_udp_encap_recv() to kill compiler warning
@ 2015-09-04 10:49 Geert Uytterhoeven
  2015-09-04 13:08 ` Jiri Benc
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Geert Uytterhoeven @ 2015-09-04 10:49 UTC (permalink / raw)
  To: Thomas Graf, David S. Miller; +Cc: netdev, linux-kernel, Geert Uytterhoeven

drivers/net/vxlan.c: In function ‘vxlan_udp_encap_recv’:
drivers/net/vxlan.c:1226: warning: ‘info’ may be used uninitialized in this function

While this warning is a false positive, it can be killed easily by
getting rid of the pointer intermediary and referring directly to the
ip_tunnel_info structure.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
Compile-tested only.
---
 drivers/net/vxlan.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index ce988fd01b3486c7..cf8b7f0473b3985a 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -1223,7 +1223,6 @@ drop:
 static int vxlan_udp_encap_recv(struct sock *sk, struct sk_buff *skb)
 {
 	struct metadata_dst *tun_dst = NULL;
-	struct ip_tunnel_info *info;
 	struct vxlan_sock *vs;
 	struct vxlanhdr *vxh;
 	u32 flags, vni;
@@ -1270,8 +1269,7 @@ static int vxlan_udp_encap_recv(struct sock *sk, struct sk_buff *skb)
 		if (!tun_dst)
 			goto drop;
 
-		info = &tun_dst->u.tun_info;
-		md = ip_tunnel_info_opts(info);
+		md = ip_tunnel_info_opts(&tun_dst->u.tun_info);
 	} else {
 		memset(md, 0, sizeof(*md));
 	}
@@ -1286,7 +1284,7 @@ static int vxlan_udp_encap_recv(struct sock *sk, struct sk_buff *skb)
 		md->gbp = ntohs(gbp->policy_id);
 
 		if (tun_dst)
-			info->key.tun_flags |= TUNNEL_VXLAN_OPT;
+			tun_dst->u.tun_info.key.tun_flags |= TUNNEL_VXLAN_OPT;
 
 		if (gbp->dont_learn)
 			md->gbp |= VXLAN_GBP_DONT_LEARN;
-- 
1.9.1

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

* Re: [PATCH] vxlan: Refactor vxlan_udp_encap_recv() to kill compiler warning
  2015-09-04 10:49 [PATCH] vxlan: Refactor vxlan_udp_encap_recv() to kill compiler warning Geert Uytterhoeven
@ 2015-09-04 13:08 ` Jiri Benc
  2015-09-04 15:00 ` Thomas Graf
  2015-09-07  2:48 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Jiri Benc @ 2015-09-04 13:08 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: Thomas Graf, David S. Miller, netdev, linux-kernel

On Fri,  4 Sep 2015 12:49:32 +0200, Geert Uytterhoeven wrote:
> drivers/net/vxlan.c: In function ‘vxlan_udp_encap_recv’:
> drivers/net/vxlan.c:1226: warning: ‘info’ may be used uninitialized in this function
> 
> While this warning is a false positive, it can be killed easily by
> getting rid of the pointer intermediary and referring directly to the
> ip_tunnel_info structure.
> 
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>

Reviewed-by: Jiri Benc <jbenc@redhat.com>

-- 
Jiri Benc

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

* Re: [PATCH] vxlan: Refactor vxlan_udp_encap_recv() to kill compiler warning
  2015-09-04 10:49 [PATCH] vxlan: Refactor vxlan_udp_encap_recv() to kill compiler warning Geert Uytterhoeven
  2015-09-04 13:08 ` Jiri Benc
@ 2015-09-04 15:00 ` Thomas Graf
  2015-09-07  2:48 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Thomas Graf @ 2015-09-04 15:00 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: David S. Miller, netdev, linux-kernel

On 09/04/15 at 12:49pm, Geert Uytterhoeven wrote:
> drivers/net/vxlan.c: In function ‘vxlan_udp_encap_recv’:
> drivers/net/vxlan.c:1226: warning: ‘info’ may be used uninitialized in this function
> 
> While this warning is a false positive, it can be killed easily by
> getting rid of the pointer intermediary and referring directly to the
> ip_tunnel_info structure.
> 
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>

Acked-by: Thomas Graf <tgraf@suug.ch>

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

* Re: [PATCH] vxlan: Refactor vxlan_udp_encap_recv() to kill compiler warning
  2015-09-04 10:49 [PATCH] vxlan: Refactor vxlan_udp_encap_recv() to kill compiler warning Geert Uytterhoeven
  2015-09-04 13:08 ` Jiri Benc
  2015-09-04 15:00 ` Thomas Graf
@ 2015-09-07  2:48 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2015-09-07  2:48 UTC (permalink / raw)
  To: geert; +Cc: tgraf, netdev, linux-kernel

From: Geert Uytterhoeven <geert@linux-m68k.org>
Date: Fri,  4 Sep 2015 12:49:32 +0200

> drivers/net/vxlan.c: In function ‘vxlan_udp_encap_recv’:
> drivers/net/vxlan.c:1226: warning: ‘info’ may be used uninitialized in this function
> 
> While this warning is a false positive, it can be killed easily by
> getting rid of the pointer intermediary and referring directly to the
> ip_tunnel_info structure.
> 
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>

Applied, thanks.

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

end of thread, other threads:[~2015-09-07  2:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-04 10:49 [PATCH] vxlan: Refactor vxlan_udp_encap_recv() to kill compiler warning Geert Uytterhoeven
2015-09-04 13:08 ` Jiri Benc
2015-09-04 15:00 ` Thomas Graf
2015-09-07  2:48 ` David Miller

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