diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2014-12-10 14:49:01 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2015-02-04 01:34:15 -0500 |
commit | aad9a1cec7dcd1d45809b64643fce37061b17788 (patch) | |
tree | cd3236a0ab568ef715f68be9777483d0d39feec1 /drivers/vhost | |
parent | 8ae5e030f30e50a81df1b269d5a5c32d023aa66d (diff) |
vhost: switch vhost get_indirect() to iov_iter, kill memcpy_fromiovec()
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: kvm@vger.kernel.org
Cc: virtualization@lists.linux-foundation.org
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'drivers/vhost')
-rw-r--r-- | drivers/vhost/vhost.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index cb807d0ea498..2ee28266fd07 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c | |||
@@ -1125,6 +1125,7 @@ static int get_indirect(struct vhost_virtqueue *vq, | |||
1125 | struct vring_desc desc; | 1125 | struct vring_desc desc; |
1126 | unsigned int i = 0, count, found = 0; | 1126 | unsigned int i = 0, count, found = 0; |
1127 | u32 len = vhost32_to_cpu(vq, indirect->len); | 1127 | u32 len = vhost32_to_cpu(vq, indirect->len); |
1128 | struct iov_iter from; | ||
1128 | int ret; | 1129 | int ret; |
1129 | 1130 | ||
1130 | /* Sanity check */ | 1131 | /* Sanity check */ |
@@ -1142,6 +1143,7 @@ static int get_indirect(struct vhost_virtqueue *vq, | |||
1142 | vq_err(vq, "Translation failure %d in indirect.\n", ret); | 1143 | vq_err(vq, "Translation failure %d in indirect.\n", ret); |
1143 | return ret; | 1144 | return ret; |
1144 | } | 1145 | } |
1146 | iov_iter_init(&from, READ, vq->indirect, ret, len); | ||
1145 | 1147 | ||
1146 | /* We will use the result as an address to read from, so most | 1148 | /* We will use the result as an address to read from, so most |
1147 | * architectures only need a compiler barrier here. */ | 1149 | * architectures only need a compiler barrier here. */ |
@@ -1164,8 +1166,8 @@ static int get_indirect(struct vhost_virtqueue *vq, | |||
1164 | i, count); | 1166 | i, count); |
1165 | return -EINVAL; | 1167 | return -EINVAL; |
1166 | } | 1168 | } |
1167 | if (unlikely(memcpy_fromiovec((unsigned char *)&desc, | 1169 | if (unlikely(copy_from_iter(&desc, sizeof(desc), &from) != |
1168 | vq->indirect, sizeof desc))) { | 1170 | sizeof(desc))) { |
1169 | vq_err(vq, "Failed indirect descriptor: idx %d, %zx\n", | 1171 | vq_err(vq, "Failed indirect descriptor: idx %d, %zx\n", |
1170 | i, (size_t)vhost64_to_cpu(vq, indirect->addr) + i * sizeof desc); | 1172 | i, (size_t)vhost64_to_cpu(vq, indirect->addr) + i * sizeof desc); |
1171 | return -EINVAL; | 1173 | return -EINVAL; |