From: John Ferlan Date: Tue, 5 May 2015 11:13:19 +0000 (-0400) Subject: qemu: Resolve Coverity FORWARD_NULL X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=b8e60f00d8f27d36350657339ab51cb4ac5469bc;p=people%2Fliuw%2Flibxenctrl-split%2Flibvirt.git qemu: Resolve Coverity FORWARD_NULL 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. --- diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index a76858a15..d173aa1d0 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -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;