Skip to contentSkip to conversation

xfrm6: remove unneeded NULL check in __xfrm6_output()

PATCH Applied Dan Carpenter 2 participants 2 messages Feb 1, 2012

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfrm6: remove unneeded NULL check in __xfrm6_output()

We don't check for NULL consistently in __xfrm6_output(). If "x" were NULL here it would lead to an OOPs later. I asked Steffen Klassert about this and he suggested that we remove the NULL check.

Quoted 8 lines · Steffen Klassert
Quoted 4 lines

net/ipv6/xfrm6_output.c
148
149 if ((x && x->props.mode = XFRM_MODE_TUNNEL) &&

                          ^

x can't be null here. It would be a bug if __xfrm6_output() is called without a xfrm_state attached to the skb. I think we can just remove this null check.

Cc Steffen Klassert <[email protected]>
net/ipv6/xfrm6_output.c +1 -1
index 4eeff89..8755a30 100644
@@ -146,7 +146,7 @@ static int __xfrm6_output(struct sk_buff *skb)
 		return -EMSGSIZE;
 	}
 
-	if ((x && x->props.mode = XFRM_MODE_TUNNEL) &&
+	if (x->props.mode = XFRM_MODE_TUNNEL &&
 	    ((skb->len > mtu && !skb_is_gso(skb)) ||
 		dst_allfrag(skb_dst(skb)))) {
 			return ip6_fragment(skb, x->outer_mode->afinfo->output_finish);
maintainer Applied
#1 lore raw

From: Dan Carpenter <[email protected]>
Date: Wed, 1 Feb 2012 10:45:26 +0300

Quoted 10 lines

We don't check for NULL consistently in __xfrm6_output(). If "x" were NULL here it would lead to an OOPs later. I asked Steffen Klassert about this and he suggested that we remove the NULL check.

Quoted 5 lines · Steffen Klassert
Quoted 4 lines

net/ipv6/xfrm6_output.c
148
149 if ((x && x->props.mode = XFRM_MODE_TUNNEL) &&

                          ^
Quoted 6 lines
Quoted 3 lines

x can't be null here. It would be a bug if __xfrm6_output() is called without a xfrm_state attached to the skb. I think we can just remove this null check.

Cc Steffen Klassert <[email protected]>

Applied, thanks Dan.