On Mon, Dec 11, 2017 at 07:59:44 -0500, John Ferlan wrote:
On 12/07/2017 08:20 AM, Jiri Denemark wrote:
> virQEMUCapsProbeQMPCPUDefinitions is now a small wrapper which fills in
> qemuCaps with CPU models fetched by virQEMUCapsFetchCPUDefinitions.
>
> Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
> ---
> src/qemu/qemu_capabilities.c | 59 +++++++++++++++++++++++++++-----------------
> src/qemu/qemu_capabilities.h | 1 +
> 2 files changed, 38 insertions(+), 22 deletions(-)
>
> diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
> index 29714855b0..8c65de956e 100644
> --- a/src/qemu/qemu_capabilities.c
> +++ b/src/qemu/qemu_capabilities.c
> @@ -2956,30 +2956,19 @@ virQEMUCapsProbeQMPMachineTypes(virQEMUCapsPtr qemuCaps,
> }
>
>
> -int
> -virQEMUCapsProbeQMPCPUDefinitions(virQEMUCapsPtr qemuCaps,
> - qemuMonitorPtr mon,
> - bool tcg)
> +virDomainCapsCPUModelsPtr
> +virQEMUCapsFetchCPUDefinitions(qemuMonitorPtr mon)
> {
> - virDomainCapsCPUModelsPtr models;
> - qemuMonitorCPUDefInfoPtr *cpus;
> - int ncpus;
> - int ret = -1;
> + virDomainCapsCPUModelsPtr models = NULL;
> + qemuMonitorCPUDefInfoPtr *cpus = NULL;
> + int ncpus = 0;
> size_t i;
>
> - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_QUERY_CPU_DEFINITIONS))
> - return 0;
> -
> if ((ncpus = qemuMonitorGetCPUDefinitions(mon, &cpus)) < 0)
> - return -1;
> + goto error;
This adjustment causes a Coverity found problem for the "for (i = 0; i <
ncpus; i++)" in cleanup: on failure ncpus == -1.
Oh right, a patch is coming...
Jirka