Netdev List
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Roel Kluin <roel.kluin@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>,
	netdev@vger.kernel.org, Andrew Morton <akpm@linux-foundation.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] [XFRM]: Don't dereference error pointer dst1
Date: Wed, 29 Sep 2010 22:45:13 +0200	[thread overview]
Message-ID: <1285793113.5211.8.camel@edumazet-laptop> (raw)
In-Reply-To: <4CA3BFA3.1060204@gmail.com>

Le jeudi 30 septembre 2010 à 00:37 +0200, Roel Kluin a écrit :
> Don't dereference dst1 when it's an error pointer.
> 
> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
> ---
>  net/xfrm/xfrm_policy.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> I just noticed this by code analysis. It wasn't tested in any way.
> 
> diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
> index cbab6e1..b186c3d 100644
> --- a/net/xfrm/xfrm_policy.c
> +++ b/net/xfrm/xfrm_policy.c
> @@ -1414,13 +1414,14 @@ static struct dst_entry *xfrm_bundle_create(struct xfrm_policy *policy,
>  
>  	for (; i < nx; i++) {
>  		struct xfrm_dst *xdst = xfrm_alloc_dst(net, family);
> -		struct dst_entry *dst1 = &xdst->u.dst;
> +		struct dst_entry *dst1;
>  
>  		err = PTR_ERR(xdst);
>  		if (IS_ERR(xdst)) {
>  			dst_release(dst);
>  			goto put_states;
>  		}
> +		dst1 = &xdst->u.dst;
>  
>  		if (!dst_prev)
>  			dst0 = dst1;
> 

This is not a dereference, but a cast from "struct xfrm_dst *" to
"struct dst_entry *"

  reply	other threads:[~2010-09-29 20:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-29 22:37 [PATCH] [XFRM]: Don't dereference error pointer dst1 Roel Kluin
2010-09-29 20:45 ` Eric Dumazet [this message]
2010-09-29 20:49   ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1285793113.5211.8.camel@edumazet-laptop \
    --to=eric.dumazet@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=roel.kluin@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox