]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
btrfs: assert RAID stripe-extent length is always greater than 0
authorJohannes Thumshirn <johannes.thumshirn@wdc.com>
Mon, 13 Jan 2025 19:31:44 +0000 (20:31 +0100)
committerDavid Sterba <dsterba@suse.com>
Tue, 14 Jan 2025 14:48:56 +0000 (15:48 +0100)
When modifying a RAID stripe-extent, ASSERT() that the length of the new
RAID stripe-extent is always greater than 0.

Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/raid-stripe-tree.c

index be923144cc85a0ecb370dbb1ebeea44269a1f4ad..0c351eda3551efec67c35d76d06e648da5f33c71 100644 (file)
@@ -28,6 +28,7 @@ static void btrfs_partially_delete_raid_extent(struct btrfs_trans_handle *trans,
                .offset = newlen,
        };
 
+       ASSERT(newlen > 0);
        ASSERT(oldkey->type == BTRFS_RAID_STRIPE_KEY);
 
        leaf = path->nodes[0];