Skip to content

Commit f65e25e

Browse files
YueHaibingkdave
authored andcommitted
btrfs: Remove unnecessary casts in btrfs_read_root_item
There is a messy cast here: min_t(int, len, (int)sizeof(*item))); min_t() should normally cast to unsigned. It's not possible for "len" to be negative, but if it were then we definitely wouldn't want to pass negatives to read_extent_buffer(). Also there is an extra cast. This patch shouldn't affect runtime, it's just a clean up. Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Qu Wenruo <wqu@suse.com> Signed-off-by: YueHaibing <yuehaibing@huawei.com> Signed-off-by: David Sterba <dsterba@suse.com>
1 parent 253002f commit f65e25e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

fs/btrfs/root-tree.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ static void btrfs_read_root_item(struct extent_buffer *eb, int slot,
2121
struct btrfs_root_item *item)
2222
{
2323
uuid_le uuid;
24-
int len;
24+
u32 len;
2525
int need_reset = 0;
2626

2727
len = btrfs_item_size_nr(eb, slot);
2828
read_extent_buffer(eb, item, btrfs_item_ptr_offset(eb, slot),
29-
min_t(int, len, (int)sizeof(*item)));
29+
min_t(u32, len, sizeof(*item)));
3030
if (len < sizeof(*item))
3131
need_reset = 1;
3232
if (!need_reset && btrfs_root_generation(item)

0 commit comments

Comments
 (0)