]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
qemu: Resolve Coverity FORWARD_NULL
authorJohn Ferlan <jferlan@redhat.com>
Tue, 5 May 2015 11:13:19 +0000 (07:13 -0400)
committerJohn Ferlan <jferlan@redhat.com>
Wed, 6 May 2015 00:02:37 +0000 (20:02 -0400)
Coverity points out that qemuMonitorGetAllBlockStatsInfo could return a
-1 and thus not fill in 'stats' (leaving it NULL). Then the call to
qemuMonitorBlockStatsUpdateCapacity will dereference it.

src/qemu/qemu_driver.c

index a76858a15ca139ebfe862f3b29282b1096fb3c2d..d173aa1d0d99e89e673854edee6485bccf9bfe6e 100644 (file)
@@ -19633,8 +19633,9 @@ qemuDomainGetStatsBlock(virQEMUDriverPtr driver,
         qemuDomainObjEnterMonitor(driver, dom);
         rc = qemuMonitorGetAllBlockStatsInfo(priv->mon, &stats,
                                              visitBacking);
-        ignore_value(qemuMonitorBlockStatsUpdateCapacity(priv->mon, stats,
-                                                         visitBacking));
+        if (rc >= 0)
+            ignore_value(qemuMonitorBlockStatsUpdateCapacity(priv->mon, stats,
+                                                             visitBacking));
         if (qemuDomainObjExitMonitor(driver, dom) < 0)
             goto cleanup;