On 23.09.19 17:50, Jan Beulich wrote:
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".
Oh, thanks for noticing.
I'll change the usage.
Juergen
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel