[patch] ipv6: pointer math error in ip6_tnl_parse_tlv_enc_lim()

Subsystems: networking [general], networking [ipv4/ipv6], the rest

STALE3490d

3 messages, 3 authors, 2017-02-01 · open the first message on its own page

[patch] ipv6: pointer math error in ip6_tnl_parse_tlv_enc_lim()

From: Dan Carpenter <hidden>
Date: 2017-02-01 08:47:34

Casting is a high precedence operation but "off" and "i" are in terms of
bytes so we need to have some parenthesis here.

Fixes: fbfa743a9d2a ("ipv6: fix ip6_tnl_parse_tlv_enc_lim()")
Signed-off-by: Dan Carpenter <redacted>
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index ff8ee06491c3..75fac933c209 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -441,7 +441,7 @@ __u16 ip6_tnl_parse_tlv_enc_lim(struct sk_buff *skb, __u8 *raw)
 				if (i + sizeof(*tel) > optlen)
 					break;
 
-				tel = (struct ipv6_tlv_tnl_enc_lim *) skb->data + off + i;
+				tel = (struct ipv6_tlv_tnl_enc_lim *)(skb->data + off + i);
 				/* return index of option if found and valid */
 				if (tel->type == IPV6_TLV_TNL_ENCAP_LIMIT &&
 				    tel->length == 1)

Re: [patch] ipv6: pointer math error in ip6_tnl_parse_tlv_enc_lim()

From: Eric Dumazet <hidden>
Date: 2017-02-01 15:26:22

On Wed, 2017-02-01 at 11:46 +0300, Dan Carpenter wrote:
Casting is a high precedence operation but "off" and "i" are in terms of
bytes so we need to have some parenthesis here.

Fixes: fbfa743a9d2a ("ipv6: fix ip6_tnl_parse_tlv_enc_lim()")
Signed-off-by: Dan Carpenter <redacted>
Silly me. Thanks Dan !

Acked-by: Eric Dumazet <edumazet@google.com>

Re: [patch] ipv6: pointer math error in ip6_tnl_parse_tlv_enc_lim()

From: David Miller <davem@davemloft.net>
Date: 2017-02-01 17:31:05

From: Dan Carpenter <redacted>
Date: Wed, 1 Feb 2017 11:46:32 +0300
Casting is a high precedence operation but "off" and "i" are in terms of
bytes so we need to have some parenthesis here.

Fixes: fbfa743a9d2a ("ipv6: fix ip6_tnl_parse_tlv_enc_lim()")
Signed-off-by: Dan Carpenter <redacted>
Applied, thanks Dan.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help