[libvirt] [PATCH] qemu: Resolve Coverity UNINIT

John Ferlan jferlan at redhat.com
Sat Nov 15 13:20:43 UTC 2014


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.

Signed-off-by: John Ferlan <jferlan at redhat.com>
---

 NOTE: 
 Using "sa_assert(flags & (VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG));
 did not clear the error - only the two separate checks using the ||.

 Yes, the parentheses are overkill...

 src/qemu/qemu_driver.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 9b19629..a84fd47 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -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
-- 
1.9.3




More information about the libvir-list mailing list