Re: [PATCH] block: Fix start and length check added to iov_iter_extract_bvecs()

From: Keith Busch

Date: Wed Aug 26 2026 - 16:03:13 EST


On Wed, Aug 26, 2026 at 08:49:00PM +0100, David Howells wrote:
> Keith Busch <kbusch@xxxxxxxxxx> wrote:
>
> > iov_iter_alignment loops over all the vectors when we only need to
> > examine the current one here.
>
> Actually, I don't think that's true. iov_iter_extract_pages() is allowed to
> pull from multiple bio_vecs in an ITER_BVEC, for example - and if, say, the
> page in the second bio_vec is contiguous with the first, then
> iov_iter_extract_bvecs() will use it - so you still need to check bv_len on
> it.

I don't think we should be extracting bvecs for the ITER_BVEC type.
bio_iov_iter_get_pages() already doesn't. I'll look more into the
recently introduced bio_iov_iter_bounce_read() usage, as there may be an
optimization there.

But in general, yeah, it should be safe for any type. The proposal I
sent a bit ago will handle the ITER_BVEC as you've desribed.