diff mbox series

[net-next] net: fou: remove redundant code in gue_udp_recv

Message ID 016e09315113bdfd10ee861e73d867dad6f69047.1554803716.git.lorenzo.bianconi@redhat.com
State Accepted
Delegated to: David Miller
Headers show
Series [net-next] net: fou: remove redundant code in gue_udp_recv | expand

Commit Message

Lorenzo Bianconi April 9, 2019, 10:03 a.m. UTC
Remove not useful protocol version check in gue_udp_recv since just
gue version 0 can hit that code. Moreover remove duplicated hdrlen
computation

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
---
 net/ipv4/fou.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

David Miller April 11, 2019, 7:09 a.m. UTC | #1
From: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Date: Tue,  9 Apr 2019 12:03:07 +0200

> Remove not useful protocol version check in gue_udp_recv since just
> gue version 0 can hit that code. Moreover remove duplicated hdrlen
> computation
> 
> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

Applied.
diff mbox series

Patch

diff --git a/net/ipv4/fou.c b/net/ipv4/fou.c
index 100e63f57ea6..c2da9314a06c 100644
--- a/net/ipv4/fou.c
+++ b/net/ipv4/fou.c
@@ -170,9 +170,7 @@  static int gue_udp_recv(struct sock *sk, struct sk_buff *skb)
 	/* guehdr may change after pull */
 	guehdr = (struct guehdr *)&udp_hdr(skb)[1];
 
-	hdrlen = sizeof(struct guehdr) + optlen;
-
-	if (guehdr->version != 0 || validate_gue_flags(guehdr, optlen))
+	if (validate_gue_flags(guehdr, optlen))
 		goto drop;
 
 	hdrlen = sizeof(struct guehdr) + optlen;