Skip to content

Commit b121197

Browse files
Jonathan Derrickliu-song-6
authored andcommitted
md: Fix bitmap offset type in sb writer
Bitmap offset is allowed to be negative, indicating that bitmap precedes metadata. Change the type back from sector_t to loff_t to satisfy conditionals and calculations. Reported-by: Dan Carpenter <dan.carpenter@linaro.org> Link: https://lore.kernel.org/linux-raid/CAPhsuW6HuaUJ5WcyPajVgUfkQFYp2D_cy1g6qxN4CU_gP2=z7g@mail.gmail.com/ Fixes: 10172f2 ("md: Fix types in sb writer") Signed-off-by: Jonathan Derrick <jonathan.derrick@linux.dev> Suggested-by: Yu Kuai <yukuai3@huawei.com> Reviewed-by: Yu Kuai <yukuai3@huawei.com> Signed-off-by: Song Liu <song@kernel.org> Link: https://lore.kernel.org/r/20230425011438.71046-1-jonathan.derrick@linux.dev
1 parent fc05e06 commit b121197

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/md/md-bitmap.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ static unsigned int optimal_io_size(struct block_device *bdev,
219219
}
220220

221221
static unsigned int bitmap_io_size(unsigned int io_size, unsigned int opt_size,
222-
sector_t start, sector_t boundary)
222+
loff_t start, loff_t boundary)
223223
{
224224
if (io_size != opt_size &&
225225
start + opt_size / SECTOR_SIZE <= boundary)
@@ -237,8 +237,8 @@ static int __write_sb_page(struct md_rdev *rdev, struct bitmap *bitmap,
237237
struct block_device *bdev;
238238
struct mddev *mddev = bitmap->mddev;
239239
struct bitmap_storage *store = &bitmap->storage;
240-
sector_t offset = mddev->bitmap_info.offset;
241-
sector_t ps, sboff, doff;
240+
loff_t sboff, offset = mddev->bitmap_info.offset;
241+
sector_t ps, doff;
242242
unsigned int size = PAGE_SIZE;
243243
unsigned int opt_size = PAGE_SIZE;
244244

0 commit comments

Comments
 (0)