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

Re: [Xen-devel] [PATCH v3 31/47] xen/sched: modify cpupool_domain_cpumask() to be an unit mask



On 14.09.2019 10:52, Juergen Gross wrote:
> --- a/xen/common/cpupool.c
> +++ b/xen/common/cpupool.c
> @@ -36,26 +36,35 @@ static DEFINE_SPINLOCK(cpupool_lock);
>  
>  DEFINE_PER_CPU(struct cpupool *, cpupool);
>  
> +static void free_cpupool_struct(struct cpupool *c)
> +{
> +    if ( c )
> +    {
> +        free_cpumask_var(c->res_valid);
> +        free_cpumask_var(c->cpu_valid);
> +    }
> +    xfree(c);
> +}
> +
>  static struct cpupool *alloc_cpupool_struct(void)
>  {
>      struct cpupool *c = xzalloc(struct cpupool);
>  
> -    if ( !c || !zalloc_cpumask_var(&c->cpu_valid) )
> +    if ( !c )
> +        return NULL;
> +
> +    zalloc_cpumask_var(&c->cpu_valid);
> +    zalloc_cpumask_var(&c->res_valid);
> +
> +    if ( !c->cpu_valid || !c->res_valid )

I guess compilers (or other static analysis tools) may warn about
this for NR_CPUS <= 2 * BITS_PER_LONG builds. The intention really
is for you to check zalloc_cpumask_var()'s return value; perhaps
it should get [have been] marked "__must_check".

Jan

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.