diff options
author | Ming Lei <ming.lei@redhat.com> | 2022-04-14 16:44:43 +0800 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2022-04-14 10:15:24 -0600 |
commit | 8535c0185d14ea41f0efd6a357961b05daf6687e (patch) | |
tree | e9c075b67cfb7fc756b503c90219c171b23cb41b /block/bio.c | |
parent | b97687527be85a55e12804c98745c5619eadcc32 (diff) | |
download | linux-8535c0185d14ea41f0efd6a357961b05daf6687e.tar.gz linux-8535c0185d14ea41f0efd6a357961b05daf6687e.tar.bz2 linux-8535c0185d14ea41f0efd6a357961b05daf6687e.zip |
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: e83502ca5f1e ("block: fix argument type of bio_trim()")
Cc: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Link: https://lore.kernel.org/r/20220414084443.1736850-1-ming.lei@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/bio.c')
-rw-r--r-- | block/bio.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/block/bio.c b/block/bio.c index cdd7b2915c53..4259125e16ab 100644 --- a/block/bio.c +++ b/block/bio.c @@ -1598,7 +1598,7 @@ EXPORT_SYMBOL(bio_split); void bio_trim(struct bio *bio, sector_t offset, sector_t size) { if (WARN_ON_ONCE(offset > BIO_MAX_SECTORS || size > BIO_MAX_SECTORS || - offset + size > bio->bi_iter.bi_size)) + offset + size > bio_sectors(bio))) return; size <<= 9; |