Skip to content

Commit

Permalink
btrfs-util: add assert to fix Coverity warning
Browse files Browse the repository at this point in the history
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 125cca1
  • Loading branch information
bluca committed May 21, 2024
1 parent e603a43 commit 5e30e6e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/shared/btrfs-util.c
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down

0 comments on commit 5e30e6e

Please sign in to comment.