[libvirt] [PATCH 22/23] tests: Add virnumamock

John Ferlan jferlan at redhat.com
Mon Mar 27 12:20:11 UTC 2017


[...]

> +int
> +virNumaGetNodeCPUs(int node, virBitmapPtr *cpus)
> +{
> +    int ret = -1;
> +    char *cpulist = NULL;
> +
> +    if (virSysfsGetNodeValueString(node, "cpulist", &cpulist) < 0)
> +        return -1;
> +
> +    *cpus = virBitmapParseUnlimited(cpulist);
> +    if (!cpus)

I think you meant "if (!*cpus)" (Coverity complained about checking for
NULL cpus before assigning to it).


John
> +        goto cleanup;
> +
> +    ret = virBitmapCountBits(*cpus);
> + cleanup:
> +    VIR_FREE(cpulist);
> +    return ret;
> +}
> 




More information about the libvir-list mailing list