[PATCH] iov_iter: Use iov_offset for length calculation in iov_iter_aligned_bvec

From: Nitesh Shetty
Date: Wed Apr 16 2025 - 01:12:32 EST


If iov_offset is non-zero, then we need to consider iov_offset in length
calculation, otherwise we might pass smaller IOs such as 512 bytes
with 256 bytes offset.

Signed-off-by: Nitesh Shetty <nj.shetty@xxxxxxxxxxx>
---
lib/iov_iter.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/iov_iter.c b/lib/iov_iter.c
index 8c7fdb7d8c8f..aa80fb094004 100644
--- a/lib/iov_iter.c
+++ b/lib/iov_iter.c
@@ -820,7 +820,7 @@ static bool iov_iter_aligned_bvec(const struct iov_iter *i, unsigned addr_mask,
size_t size = i->count;

do {
- size_t len = bvec->bv_len;
+ size_t len = bvec->bv_len - skip;

if (len > size)
len = size;

base-commit: 834a4a689699090a406d1662b03affa8b155d025
--
2.43.0