Skip to contentSkip to conversation

block: bio: Trim bio to sensible size in bio_trim()

PATCH linmiaohe 1 participant 1 message Aug 31, 2020 Block layer

lore
Share & tools
lore

linmiaohe

author
#0 lore raw
Quoted 5 lines · Jens Axboe
Quoted 1 line · Miaohe Lin

Trim bio to sensible size in bio_trim() or something bad may happen.

This really needs a LOT more detail. What is "something bad"? How does this condition trigger to begin with?

Many thanks for your reply.

I do this mainly by code review, so I didn't find the condition trigger to begin with. But I think it's better to do such a check as this is a external Interface. Also If bio_trim() set bio->bi_iter.bi_size to a value larger than the origin one, we may access the bio_vec past the last one of bio->bi_io_vec in for_each_bvec macro.

Quoted 3 lines

--
Jens Axboe