Netdev List
 help / color / mirror / Atom feed
From: Herbert Xu <herbert@gondor.apana.org.au>
To: Dongliang Mu <mudongliangabcd@gmail.com>
Cc: Steffen Klassert <steffen.klassert@secunet.com>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	dan.carpenter@oracle.com,
	syzbot+b9cfd1cc5d57ee0a09ab@syzkaller.appspotmail.com,
	stable@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] net: xfrm: assign the per_cpu_ptr pointer before return
Date: Wed, 18 Aug 2021 11:32:07 +0800	[thread overview]
Message-ID: <20210818033207.GA19350@gondor.apana.org.au> (raw)
In-Reply-To: <20210818032554.283428-1-mudongliangabcd@gmail.com>

On Wed, Aug 18, 2021 at 11:25:53AM +0800, Dongliang Mu wrote:
>
> diff --git a/net/xfrm/xfrm_ipcomp.c b/net/xfrm/xfrm_ipcomp.c
> index cb40ff0ff28d..01dbec70dfba 100644
> --- a/net/xfrm/xfrm_ipcomp.c
> +++ b/net/xfrm/xfrm_ipcomp.c
> @@ -223,9 +223,9 @@ static void * __percpu *ipcomp_alloc_scratches(void)
>  		void *scratch;
>  
>  		scratch = vmalloc_node(IPCOMP_SCRATCH_SIZE, cpu_to_node(i));
> +		*per_cpu_ptr(scratches, i) = scratch;
>  		if (!scratch)
>  			return NULL;
> -		*per_cpu_ptr(scratches, i) = scratch;

scratches comes from alloc_percpu so it should already be zeroed.

Cheers,
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

  reply	other threads:[~2021-08-18  3:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-18  3:25 [PATCH] net: xfrm: assign the per_cpu_ptr pointer before return Dongliang Mu
2021-08-18  3:32 ` Herbert Xu [this message]
2021-08-18 10:39   ` Dongliang Mu
2021-08-18 12:48     ` Herbert Xu

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=20210818033207.GA19350@gondor.apana.org.au \
    --to=herbert@gondor.apana.org.au \
    --cc=dan.carpenter@oracle.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mudongliangabcd@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=steffen.klassert@secunet.com \
    --cc=syzbot+b9cfd1cc5d57ee0a09ab@syzkaller.appspotmail.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