netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] xfrm6: remove unneeded NULL check in __xfrm6_output()
@ 2012-02-01  7:45 Dan Carpenter
  2012-02-01  7:53 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2012-02-01  7:45 UTC (permalink / raw)
  To: David S. Miller, steffen.klassert
  Cc: Alexey Kuznetsov, James Morris, Hideaki YOSHIFUJI,
	Patrick McHardy, netdev, kernel-janitors

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.

On 10/29/11, Steffen Klassert <steffen.klassert@secunet.com> wrote:
>> 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 <steffen.klassert@secunet.com>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/net/ipv6/xfrm6_output.c b/net/ipv6/xfrm6_output.c
index 4eeff89..8755a30 100644
--- a/net/ipv6/xfrm6_output.c
+++ b/net/ipv6/xfrm6_output.c
@@ -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);

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

* Re: [patch] xfrm6: remove unneeded NULL check in __xfrm6_output()
  2012-02-01  7:45 [patch] xfrm6: remove unneeded NULL check in __xfrm6_output() Dan Carpenter
@ 2012-02-01  7:53 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2012-02-01  7:53 UTC (permalink / raw)
  To: dan.carpenter
  Cc: steffen.klassert, kuznet, jmorris, yoshfuji, kaber, netdev,
	kernel-janitors

From: Dan Carpenter <dan.carpenter@oracle.com>
Date: Wed, 1 Feb 2012 10:45:26 +0300

> 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.
> 
> On 10/29/11, Steffen Klassert <steffen.klassert@secunet.com> wrote:
>>> 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 <steffen.klassert@secunet.com>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Applied, thanks Dan.

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

end of thread, other threads:[~2012-02-01  7:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-01  7:45 [patch] xfrm6: remove unneeded NULL check in __xfrm6_output() Dan Carpenter
2012-02-01  7:53 ` 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).