Re: [PATCH v10 2/8] iov_iter: Add a function to extract a page list from an iterator

From: David Howells
Date: Thu Jan 26 2023 - 06:38:03 EST


iov_iter_extract_kvec_pages() isn't quite right. The problem is that there's
not currently any path by which it can be tested, as currently
iov_iter_get_pages*() balk at it, but I managed to do that by piggybacking
some testing code on my cifs patches.

The attached change fixes the problem.

David

--- a/lib/iov_iter.c
+++ b/lib/iov_iter.c
@@ -2080,9 +2080,9 @@ static ssize_t iov_iter_extract_kvec_pages(struct iov_iter *i,
skip = 0;
}

- offset = skip % PAGE_SIZE;
+ kaddr = i->kvec->iov_base + skip;
+ offset = (unsigned long)kaddr & ~PAGE_MASK;
*offset0 = offset;
- kaddr = i->kvec->iov_base;

maxpages = want_pages_array(pages, maxsize, offset, maxpages);
if (!maxpages)