]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
btrfs-util: add assert to fix Coverity warning
authorLuca Boccassi <bluca@debian.org>
Tue, 21 May 2024 12:32:48 +0000 (13:32 +0100)
committerLuca Boccassi <luca.boccassi@gmail.com>
Tue, 21 May 2024 20:17:09 +0000 (22:17 +0200)
Coverity gets confused since the iterator change, so add an
assert to indicate that this is allocated if n_old_groups is > 0

CID#1545922

Follow-up for 125cca1b51e19d9209a229fca4fb9d94d34c3e78

src/shared/btrfs-util.c

index d6b218d842f69189146098bf937206002bdc6c58..f6055a8dba2462aa6fe5c62a2755b4b6299b075a 100644 (file)
@@ -1187,6 +1187,8 @@ static int copy_quota_hierarchy(int fd, uint64_t old_subvol_id, uint64_t new_sub
         if (n_old_qgroups <= 0) /* Nothing to copy */
                 return n_old_qgroups;
 
+        assert(old_qgroups); /* Coverity gets confused by the macro iterator allocating this, add a hint */
+
         r = btrfs_subvol_get_parent(fd, old_subvol_id, &old_parent_id);
         if (r == -ENXIO)
                 /* We have no parent, hence nothing to copy. */