]> git.ipfire.org Git - thirdparty/libvirt.git/commit
daemon: Resolve Coverity FORWARD_NULL
authorJohn Ferlan <jferlan@redhat.com>
Fri, 12 Sep 2014 12:40:07 +0000 (08:40 -0400)
committerJohn Ferlan <jferlan@redhat.com>
Mon, 15 Sep 2014 15:01:37 +0000 (11:01 -0400)
commit1f967758664e33d332bcd8449801e78d73d769e9
tree33f71fdf16ffa6cc831dce86fc9b897a4ca84e22
parent3a0002b588bb32ee71173b656f9d050584e7bdb2
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.

Adjusted code to add ATTRIBUTE_NONNULL(3) on incoming path parameter and
then fixup the comparison of nfds to be a comparison against 2 or 1
depending on whether sock_path_ro is NULL or not.
daemon/libvirtd.c