[libvirt] [PATCH 05/26] qemu: Resolve Coverity REVERSE_INULL

John Ferlan jferlan at redhat.com
Thu Sep 4 22:26:13 UTC 2014


Coverity complains that checking for !domlist after setting doms = domlist
and making a deref of doms just above

It seems the call in question was intended to me made in the case that
'doms' was passed in and not when the virDomainObjListExport() call
allocated domlist and already called virConnectGetAllDomainStatsCheckACL().

Thus rather than check for !domlist - check that "doms != domlist" in
order to avoid the Coverity message.

Signed-off-by: John Ferlan <jferlan at redhat.com>
---
 src/qemu/qemu_driver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index f52f00d..362d1ab 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -17363,7 +17363,7 @@ qemuConnectGetAllDomainStats(virConnectPtr conn,
         if (!(dom = qemuDomObjFromDomain(doms[i])))
             continue;
 
-        if (!domlist &&
+        if (doms != domlist &&
             !virConnectGetAllDomainStatsCheckACL(conn, dom->def))
             continue;
 
-- 
1.9.3




More information about the libvir-list mailing list