Skip to content

Commit 8535c01

Browse files
Ming Leiaxboe
authored andcommitted
block: fix offset/size check in bio_trim()
Unit of bio->bi_iter.bi_size is bytes, but unit of offset/size is sector. Fix the above issue in checking offset/size in bio_trim(). Fixes: e83502c ("block: fix argument type of bio_trim()") Cc: Chaitanya Kulkarni <[email protected]> Signed-off-by: Ming Lei <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent b976875 commit 8535c01

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

block/bio.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1598,7 +1598,7 @@ EXPORT_SYMBOL(bio_split);
15981598
void bio_trim(struct bio *bio, sector_t offset, sector_t size)
15991599
{
16001600
if (WARN_ON_ONCE(offset > BIO_MAX_SECTORS || size > BIO_MAX_SECTORS ||
1601-
offset + size > bio->bi_iter.bi_size))
1601+
offset + size > bio_sectors(bio)))
16021602
return;
16031603

16041604
size <<= 9;

0 commit comments

Comments
 (0)