linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iov_iter: add missing handling for ITER_KVEC in iov_iter_single_seg_count
@ 2017-01-06 15:59 Jeff Layton
  0 siblings, 0 replies; only message in thread
From: Jeff Layton @ 2017-01-06 15:59 UTC (permalink / raw)
  To: Al Viro; +Cc: linux-fsdevel, linux-kernel

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

Signed-off-by: Jeff Layton <jlayton@redhat.com>
---
 lib/iov_iter.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/iov_iter.c b/lib/iov_iter.c
index f2bd21b93dfc..6b415b5a100d 100644
--- a/lib/iov_iter.c
+++ b/lib/iov_iter.c
@@ -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);
 }
-- 
2.7.4

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2017-01-06 15:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-06 15:59 [PATCH] iov_iter: add missing handling for ITER_KVEC in iov_iter_single_seg_count Jeff Layton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).