[libvirt PATCH] qemu: Do not pass negative ncpus to virCapabilitiesClearHostNUMACellCPUTopology
Michal Prívozník
mprivozn at redhat.com
Fri Nov 5 08:14:09 UTC 2021
On 11/4/21 7:54 PM, Jiri Denemark wrote:
> It won't cause any harm as cpus is NULL when we pass a negative ncpus,
> but doing so when the function expects unsigned value is not right.
>
> Signed-off-by: Jiri Denemark <jdenemar at redhat.com>
> ---
> src/conf/capabilities.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/src/conf/capabilities.c b/src/conf/capabilities.c
> index a3e68741a9..cea4803fc8 100644
> --- a/src/conf/capabilities.c
> +++ b/src/conf/capabilities.c
> @@ -1954,6 +1954,7 @@ virCapabilitiesHostNUMAInitReal(virCapsHostNUMA *caps)
> if (ncpus == -2)
> continue;
>
> + ncpus = 0;
> goto cleanup;
> }
>
>
Alternatively, we may just 'return -1' instead of 'goto cleanup'.
Reviewed-by: Michal Privoznik <mprivozn at redhat.com>
Michal
More information about the libvir-list
mailing list