]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: Resolve Coverity UNINIT
authorJohn Ferlan <jferlan@redhat.com>
Sat, 15 Nov 2014 13:09:53 +0000 (08:09 -0500)
committerJohn Ferlan <jferlan@redhat.com>
Sat, 15 Nov 2014 13:09:53 +0000 (08:09 -0500)
For some reason, commit id '72b4151f' triggered a Coverity uninitialized
'reply' variable check when referenced within the for loop.

It seems Coverity doesn't know that flags will have to be either AFFECT_LIVE
or AFFECT_CONFIG after the virDomainLiveConfigHelperMethod call.

By adding a "sa_assert()" to confirm that fact, Coverity is happy again.

src/qemu/qemu_driver.c

index 9b19629a02ba11c7785eefba0725cb82e71a5f24..a84fd479e7e0e6e62681e81856d5e73c31674c9f 100644 (file)
@@ -17000,6 +17000,8 @@ qemuDomainGetBlockIoTune(virDomainPtr dom,
     if (virDomainLiveConfigHelperMethod(caps, driver->xmlopt, vm, &flags,
                                         &persistentDef) < 0)
         goto endjob;
+    sa_assert((flags & VIR_DOMAIN_AFFECT_LIVE) ||
+              (flags & VIR_DOMAIN_AFFECT_CONFIG));
 
     if (flags & VIR_DOMAIN_AFFECT_LIVE) {
         /* If the VM is running, we can check if the current VM can use