[PATCH 14/3] rpc: silence coverity false positives

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

 



In virNetServerNew, Coverity didn't realize that srv->mdsnGroupName
can only be non-NULL if mdsnGroupName was non-NULL.

In virNetServerRun, Coverity didn't realize that the array is non-NULL
if the array count is non-zero.

* src/rpc/virnetserver.c (virNetServerNew): Use alternate pointer.
(virNetServerRun): Give coverity a hint.
---
 src/rpc/virnetserver.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/src/rpc/virnetserver.c b/src/rpc/virnetserver.c
index 4deeca1..5e4826b 100644
--- a/src/rpc/virnetserver.c
+++ b/src/rpc/virnetserver.c
@@ -308,7 +308,8 @@ virNetServerPtr virNetServerNew(size_t min_workers,
     if (srv->mdnsGroupName) {
         if (!(srv->mdns = virNetServerMDNSNew()))
             goto error;
-        if (!(srv->mdnsGroup = virNetServerMDNSAddGroup(srv->mdns, mdnsGroupName)))
+        if (!(srv->mdnsGroup = virNetServerMDNSAddGroup(srv->mdns,
+                                                        srv->mdnsGroupName)))
             goto error;
     }
 #endif
@@ -702,6 +703,9 @@ void virNetServerRun(virNetServerPtr srv)

     reprocess:
         for (i = 0 ; i < srv->nclients ; i++) {
+            /* Coverity 5.3.0 couldn't see that srv->clients is non-NULL
+             * if srv->nclients is non-zero.  */
+            sa_assert(srv->clients);
             if (virNetServerClientWantClose(srv->clients[i]))
                 virNetServerClientClose(srv->clients[i]);
             if (virNetServerClientIsClosed(srv->clients[i])) {
-- 
1.7.4.4

--
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]