diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2016-11-01 22:09:04 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2016-12-05 14:33:36 -0500 |
commit | cbbd26b8b1a6af9c02e2b6523e12bd50cc765059 (patch) | |
tree | 6d1b258c99e83f320cf3611bdc927121df7e9b03 /drivers/vhost/vhost.c | |
parent | e5517c2a5a49ed5e99047008629f1cd60246ea0e (diff) |
[iov_iter] new primitives - copy_from_iter_full() and friends
copy_from_iter_full(), copy_from_iter_full_nocache() and
csum_and_copy_from_iter_full() - counterparts of copy_from_iter()
et.al., advancing iterator only in case of successful full copy
and returning whether it had been successful or not.
Convert some obvious users. *NOTE* - do not blindly assume that
something is a good candidate for those unless you are sure that
not advancing iov_iter in failure case is the right thing in
this case. Anything that does short read/short write kind of
stuff (or is in a loop, etc.) is unlikely to be a good one.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'drivers/vhost/vhost.c')
-rw-r--r-- | drivers/vhost/vhost.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index c6f2d89c0e97..06e8b81b6253 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c | |||
@@ -1862,8 +1862,7 @@ static int get_indirect(struct vhost_virtqueue *vq, | |||
1862 | i, count); | 1862 | i, count); |
1863 | return -EINVAL; | 1863 | return -EINVAL; |
1864 | } | 1864 | } |
1865 | if (unlikely(copy_from_iter(&desc, sizeof(desc), &from) != | 1865 | if (unlikely(!copy_from_iter_full(&desc, sizeof(desc), &from))) { |
1866 | sizeof(desc))) { | ||
1867 | vq_err(vq, "Failed indirect descriptor: idx %d, %zx\n", | 1866 | vq_err(vq, "Failed indirect descriptor: idx %d, %zx\n", |
1868 | i, (size_t)vhost64_to_cpu(vq, indirect->addr) + i * sizeof desc); | 1867 | i, (size_t)vhost64_to_cpu(vq, indirect->addr) + i * sizeof desc); |
1869 | return -EINVAL; | 1868 | return -EINVAL; |