]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
build: silence false positive clang report
authorEric Blake <eblake@redhat.com>
Mon, 14 Feb 2011 21:23:11 +0000 (14:23 -0700)
committerEric Blake <eblake@redhat.com>
Mon, 14 Feb 2011 22:37:32 +0000 (15:37 -0700)
clang complained that STREQ(group->controllers[i].mountPoint,...)  was
a NULL dereference when i==VIR_CGROUP_CONTROLLER_CPUSET, because it
assumes the worst about virCgroupPathOfController.  Marking the
argument const doesn't yet have an effect, per this clang bug:
http://llvm.org/bugs/show_bug.cgi?id=7758

So, we use sa_assert, which was designed to shut up false positives
from tools like clang.

* src/util/cgroup.c (virCgroupMakeGroup): Teach clang that there
is no NULL dereference.

src/util/cgroup.c

index de1fd8e24b24d8409526ff1e8a2c2cb08c3ffdcb..47c46330674586600e0106d2ff5c6d5efc49fa49 100644 (file)
@@ -505,6 +505,9 @@ static int virCgroupMakeGroup(virCgroupPtr parent, virCgroupPtr group,
         rc = virCgroupPathOfController(group, i, "", &path);
         if (rc < 0)
             return rc;
+        /* As of Feb 2011, clang can't see that the above function
+         * call did not modify group. */
+        sa_assert(group->controllers[i].mountPoint);
 
         VIR_DEBUG("Make controller %s", path);
         if (access(path, F_OK) != 0) {