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

Re: [libvirt] [PATCH] libxl: implement NUMA capabilities reporting



On 08/16/2013 05:46 PM, Jim Fehlig wrote:
> From: Dario Faggioli <dario faggioli citrix com>

...snip...

> +
> + cleanup:
> +    if (ret != 0) {
> +        for (i = 0; i < nr_nodes; i++)
> +            VIR_FREE(cpus[i]);
> +        virCapabilitiesFreeNUMAInfo(caps);
> +    }
> +

Coverity got grumpy with respect to the above loop.  While I can only
assume logically that 'nr_nodes' is not changed if libxl_get_numainfo()
returns NULL, Coverity doesn't assume that.

Also, even if libxl_get_numainfo() did return data and nr_nodes had a
value, if the "else" condition fails, eg "if (cpu_topo == NULL ||
nr_cpus == 0) {", then 'nr_nodes > 0', but 'cpus' is still NULL, which
will cause sudden death syndrome :-).

The following resolves Coverity's complaint and keeps things safer:

-        for (i = 0; i < nr_nodes; i++)
+        for (i = 0; cpus && i < nr_nodes; i++)

John


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