mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-04 08:08:54 +00:00
block: fix offset/size check in bio_trim()
[ Upstream commit8535c0185d
] 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:e83502ca5f
("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> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
279018a01b
commit
3e67054c33
1 changed files with 1 additions and 1 deletions
|
@ -1552,7 +1552,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;
|
||||
|
|
Loading…
Reference in a new issue