From 5e30e6e28190fe30e76e071b2eb99546abcee7e6 Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Tue, 21 May 2024 13:32:48 +0100 Subject: [PATCH] btrfs-util: add assert to fix Coverity warning 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 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/shared/btrfs-util.c b/src/shared/btrfs-util.c index d6b218d842f69..f6055a8dba246 100644 --- a/src/shared/btrfs-util.c +++ b/src/shared/btrfs-util.c @@ -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. */