projects/linux·commit 0bcc4025

netfs: Fix netfs_extract_iter_to_sg() for ITER_UBUF/IOVEC

0bcc4025 · David Howells <[email protected]> · 2023-04-12 13:18:57 +01:00

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")
Signed-off-by: David Howells <[email protected]>
Reviewed-by: Jeff Layton <[email protected]>
Cc: Steve French <[email protected]>
Cc: Shyam Prasad N <[email protected]>
Cc: Rohith Surabattula <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Commit
0bcc4025550403ae28d2984bddacafbca0a2f112
Parents
e62252bc

Changes

1 files changed · +1 −1

FileStatusAddDelContent
fs/netfs/iterator.cmodified+1−1View file

fs/netfs/iterator.c

View file
diff --git a/fs/netfs/iterator.c b/fs/netfs/iterator.c
index e9a45de..8a4c866 100644
--- a/fs/netfs/iterator.c
+++ b/fs/netfs/iterator.c
@@ -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;