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 <[email protected]>
> ---
>  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 <[email protected]>

Michal

Reply via email to