]> git.ipfire.org Git - thirdparty/libvirt.git/commit
Fix build with GCC's static analysis
authorMartin Kletzander <mkletzan@redhat.com>
Mon, 27 Mar 2017 10:29:27 +0000 (12:29 +0200)
committerMartin Kletzander <mkletzan@redhat.com>
Mon, 27 Mar 2017 11:12:23 +0000 (13:12 +0200)
commiteec3b255d26e7b38bdb0830990569fd91aee661f
tree15f27bf9010442d9b358becb4c762e6ad1011477
parent91c3d430c96ca365ae40bf922df3e4f83295e331
Fix build with GCC's static analysis

STREQ_NULLABLE returns true if both parameters are NULL.  And that's
not what we want here.  We just want to skop comparing source nodes
that don't have that info set.  The function wouldn't make much sense
with nodeName == NULL, so we don't need to check that.  Moreover, the
function's declaration uses ATTRIBUDE_NONNULL for nodeName, which not
only means that function expects the parameter not to be NULL, but
actually tells the compiler that it can optimize out the NULL checks.
That way it could end up calling strcmp on NULL (either nodeformat or
nodebacking).  GCC figures this out if libvirt is compiled with
lv_cv_static_analysis=yes, unfortunately not everyone uses that.

Caused by cbc6d53513568c9c9613b3eaae1c8a8230fd6aab.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
src/util/virstoragefile.c