[PATCH 1/3] qemu: do not copy out non-existent block job info

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Valgrind complained:

==23975== Conditional jump or move depends on uninitialised value(s)
==23975==    at 0x22255FA6: qemuDomainGetBlockJobInfo (qemu_driver.c:16538)
==23975==    by 0x538E97C: virDomainGetBlockJobInfo (libvirt-domain.c:9685)
==23975==    by 0x12F740: remoteDispatchDomainGetBlockJobInfoHelper (remote.c:2834)
==23975==    by 0x53FF287: virNetServerProgramDispatch (virnetserverprogram.c:437)
==23975==    by 0x540523D: virNetServerProcessMsg (virnetserver.c:135)
==23975==    by 0x54052C7: virNetServerHandleJob (virnetserver.c:156)
==23975==    by 0x52F515B: virThreadPoolWorker (virthreadpool.c:145)
==23975==    by 0x52F4668: virThreadHelper (virthread.c:206)
==23975==    by 0x6E08A50: start_thread (in /lib64/libpthread-2.12.so)
==23975==    by 0x82BE93C: clone (in /lib64/libc-2.12.so)
==23975==
==23975== Conditional jump or move depends on uninitialised value(s)
==23975==    at 0x22255FB4: qemuDomainGetBlockJobInfo (qemu_driver.c:16542)
==23975==    by 0x538E97C: virDomainGetBlockJobInfo (libvirt-domain.c:9685)
==23975==    by 0x12F740: remoteDispatchDomainGetBlockJobInfoHelper (remote.c:2834)
==23975==    by 0x53FF287: virNetServerProgramDispatch (virnetserverprogram.c:437)
==23975==    by 0x540523D: virNetServerProcessMsg (virnetserver.c:135)
==23975==    by 0x54052C7: virNetServerHandleJob (virnetserver.c:156)
==23975==    by 0x52F515B: virThreadPoolWorker (virthreadpool.c:145)
==23975==    by 0x52F4668: virThreadHelper (virthread.c:206)
==23975==    by 0x6E08A50: start_thread (in /lib64/libpthread-2.12.so)
==23975==    by 0x82BE93C: clone (in /lib64/libc-2.12.so)

If no matching block job is found, qemuMonitorGetBlockJobInfo returns 0
and we should not write anything to the caller-supplied
virDomainBlockJobInfo pointer.

Signed-off-by: Michael Chapman <mike@xxxxxxxxxxxxxxxxx>
---
 src/qemu/qemu_driver.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index e8ba3a6..304165c 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -16527,7 +16527,7 @@ qemuDomainGetBlockJobInfo(virDomainPtr dom,
                                      disk->info.alias, &rawInfo);
     if (qemuDomainObjExitMonitor(driver, vm) < 0)
         ret = -1;
-    if (ret < 0)
+    if (ret <= 0)
         goto endjob;
 
     info->cur = rawInfo.cur;
@@ -16554,7 +16554,7 @@ qemuDomainGetBlockJobInfo(virDomainPtr dom,
      * we can ignore failure because it is only an optimization.  We
      * hold the vm lock, so modifying the in-memory representation is
      * safe, even if we are a query rather than a modify job. */
-    if (ret == 1 && disk->mirror &&
+    if (disk->mirror &&
         rawInfo.ready != 0 &&
         info->cur == info->end && !disk->mirrorState) {
         virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
-- 
2.4.3

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]