Skip to contentSkip to conversation

iov_iter: add missing handling for ITER_KVEC in iov_iter_single_seg_count

PATCH New Jeff Layton 1 participant 1 message Jan 6, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iov_iter: add missing handling for ITER_KVEC in iov_iter_single_seg_count

This seems to currently work by happenstance since kvec and iovec fields basically the same, but it's probably better to make this explicit.

---
 lib/iov_iter.c | 2 ++
 1 file changed, 2 insertions(+)
lib/iov_iter.c +2 -0
index f2bd21b93dfc..6b415b5a100d 100644
@@ -738,6 +738,8 @@ size_t iov_iter_single_seg_count(const struct iov_iter *i)
 		return i->count;
 	else if (i->type & ITER_BVEC)
 		return min(i->count, i->bvec->bv_len - i->iov_offset);
+	else if (i->type & ITER_KVEC)
+		return min(i->count, i->kvec->iov_len - i->iov_offset);
 	else
 		return min(i->count, i->iov->iov_len - i->iov_offset);
 }
Signature · 1 line
2.7.4