Re: [PATCH] net: xfrm: assign the per_cpu_ptr pointer before return

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux