Skip to contentSkip to conversation

netfs: Fix netfs_extract_iter_to_sg() for ITER_UBUF/IOVEC

PATCH Applied David Howells 2 participants 2 messages Apr 12, 2023

Subsystems (4)
lore
Share & tools
lore

David Howells

author maintainer
#0 lore raw

PATCH 1/1 netfs: Fix netfs_extract_iter_to_sg() for ITER_UBUF/IOVEC

Hi Linus,

Could you apply this, please? It doesn't affect anything yet, but I have patches in the works that will use it.

Thanks,
David
---
netfs: Fix netfs_extract_iter_to_sg() for ITER_UBUF/IOVEC

Fix netfs_extract_iter_to_sg() for ITER_UBUF and ITER_IOVEC to set the size of the page to the part of the page extracted, not the remaining amount of data in the extracted page array at that point.

This doesn't yet affect anything as cifs, the only current user, only passes in non-user-backed iterators.

Fixes 018584697533 ("netfs: Add a function to extract an iterator into a scatterlist")
cc Steve French <[email protected]>
cc Shyam Prasad N <[email protected]>
cc Rohith Surabattula <[email protected]>
---
 fs/netfs/iterator.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/netfs/iterator.c +1 -1
index e9a45dea748a..8a4c86687429 100644
@@ -139,7 +139,7 @@ static ssize_t netfs_extract_user_to_sg(struct iov_iter *iter,
 			size_t seg = min_t(size_t, PAGE_SIZE - off, len);
 
 			*pages++ = NULL;
-			sg_set_page(sg, page, len, off);
+			sg_set_page(sg, page, seg, off);
 			sgtable->nents++;
 			sg++;
 			len -= seg;
#1 lore raw
Quoted 3 lines · David Howells

Could you apply this, please? It doesn't affect anything yet, but I have patches in the works that will use it.

Applied,

Linus