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

[libvirt] [PATCH 8/8] daemon: Resolve Coverity FORWARD_NULL

Coverity complains that the comparison:

  if (nfds && nfds > ((int)!!sock_path + (int)!!sock_path_ro))

could mean 'sock_path' is NULL. Later in virNetSocketNewListenUNIX
there's a direct dereference of path in the error path:

  if (path[0] != '@')

A bit of sleuthing proves that upon entry to daemonSetupNetworking
there is no way for 'sock_path' to be NULL since daemonUnixSocketPaths
will set up 'sock_file' (although it may not set up 'sock_file_ro')
in all 3 paths.

So to keep Coverity quiet - add an sa_assert prior to the call.

Signed-off-by: John Ferlan <jferlan redhat com>
 daemon/libvirtd.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
index 05ee50e..028145e 100644
--- a/daemon/libvirtd.c
+++ b/daemon/libvirtd.c
@@ -502,6 +502,7 @@ static int daemonSetupNetworking(virNetServerPtr srv,
             return -1;
+    sa_assert(sock_path);
     if (nfds && nfds > ((int)!!sock_path + (int)!!sock_path_ro)) {
         VIR_ERROR(_("Too many (%u) FDs passed from caller"), nfds);
         return -1;

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