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 125cca1b51
This commit is contained in:
Luca Boccassi
2024-05-21 13:32:48 +01:00
committed by Luca Boccassi
parent e603a438a7
commit 5e30e6e281

View 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. */