On Thu, Jun 06, 2024 at 06:32:20PM +0300, Ofir Gal wrote: > + unsigned int bitmap_limit = (bitmap->storage.file_pages - pg_index) << PAGE_SHIFT; Please split the line after the "<<". > loff_t sboff, offset = mddev->bitmap_info.offset; > sector_t ps = pg_index * PAGE_SIZE / SECTOR_SIZE; > unsigned int size = PAGE_SIZE; > @@ -273,7 +274,7 @@ static int __write_sb_page(struct md_rdev *rdev, struct bitmap *bitmap, > /* DATA METADATA BITMAP - no problems */ > } > > - md_super_write(mddev, rdev, sboff + ps, (int) size, page); > + md_super_write(mddev, rdev, sboff + ps, (int)min(size, bitmap_limit), page); and drop the pointless case here. With that: Reviewed-by: Christoph Hellwig <hch@xxxxxx>