diff options
author | Michael S. Tsirkin <mst@redhat.com> | 2010-09-19 09:56:30 -0400 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2010-11-04 07:22:12 -0400 |
commit | 8b7347aab6865ae8a2e5a8b0f1deea12da3d3aff (patch) | |
tree | 3a4b901beefa1bc4f8ed5fb5efc33bf4adba8240 /drivers/vhost/vhost.c | |
parent | dfe5ac5b18be5b10d01a17e734a9905c0def6088 (diff) |
vhost: get/put_user -> __get/__put_user
We do access_ok checks on all ring values on an ioctl,
so we don't need to redo them on each access.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'drivers/vhost/vhost.c')
-rw-r--r-- | drivers/vhost/vhost.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index e6a093187a0e..a29d91c776b4 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c | |||
@@ -1095,7 +1095,7 @@ int vhost_get_vq_desc(struct vhost_dev *dev, struct vhost_virtqueue *vq, | |||
1095 | 1095 | ||
1096 | /* Check it isn't doing very strange things with descriptor numbers. */ | 1096 | /* Check it isn't doing very strange things with descriptor numbers. */ |
1097 | last_avail_idx = vq->last_avail_idx; | 1097 | last_avail_idx = vq->last_avail_idx; |
1098 | if (unlikely(get_user(vq->avail_idx, &vq->avail->idx))) { | 1098 | if (unlikely(__get_user(vq->avail_idx, &vq->avail->idx))) { |
1099 | vq_err(vq, "Failed to access avail idx at %p\n", | 1099 | vq_err(vq, "Failed to access avail idx at %p\n", |
1100 | &vq->avail->idx); | 1100 | &vq->avail->idx); |
1101 | return -EFAULT; | 1101 | return -EFAULT; |
@@ -1116,8 +1116,8 @@ int vhost_get_vq_desc(struct vhost_dev *dev, struct vhost_virtqueue *vq, | |||
1116 | 1116 | ||
1117 | /* Grab the next descriptor number they're advertising, and increment | 1117 | /* Grab the next descriptor number they're advertising, and increment |
1118 | * the index we've seen. */ | 1118 | * the index we've seen. */ |
1119 | if (unlikely(get_user(head, | 1119 | if (unlikely(__get_user(head, |
1120 | &vq->avail->ring[last_avail_idx % vq->num]))) { | 1120 | &vq->avail->ring[last_avail_idx % vq->num]))) { |
1121 | vq_err(vq, "Failed to read head: idx %d address %p\n", | 1121 | vq_err(vq, "Failed to read head: idx %d address %p\n", |
1122 | last_avail_idx, | 1122 | last_avail_idx, |
1123 | &vq->avail->ring[last_avail_idx % vq->num]); | 1123 | &vq->avail->ring[last_avail_idx % vq->num]); |
@@ -1216,17 +1216,17 @@ int vhost_add_used(struct vhost_virtqueue *vq, unsigned int head, int len) | |||
1216 | /* The virtqueue contains a ring of used buffers. Get a pointer to the | 1216 | /* The virtqueue contains a ring of used buffers. Get a pointer to the |
1217 | * next entry in that used ring. */ | 1217 | * next entry in that used ring. */ |
1218 | used = &vq->used->ring[vq->last_used_idx % vq->num]; | 1218 | used = &vq->used->ring[vq->last_used_idx % vq->num]; |
1219 | if (put_user(head, &used->id)) { | 1219 | if (__put_user(head, &used->id)) { |
1220 | vq_err(vq, "Failed to write used id"); | 1220 | vq_err(vq, "Failed to write used id"); |
1221 | return -EFAULT; | 1221 | return -EFAULT; |
1222 | } | 1222 | } |
1223 | if (put_user(len, &used->len)) { | 1223 | if (__put_user(len, &used->len)) { |
1224 | vq_err(vq, "Failed to write used len"); | 1224 | vq_err(vq, "Failed to write used len"); |
1225 | return -EFAULT; | 1225 | return -EFAULT; |
1226 | } | 1226 | } |
1227 | /* Make sure buffer is written before we update index. */ | 1227 | /* Make sure buffer is written before we update index. */ |
1228 | smp_wmb(); | 1228 | smp_wmb(); |
1229 | if (put_user(vq->last_used_idx + 1, &vq->used->idx)) { | 1229 | if (__put_user(vq->last_used_idx + 1, &vq->used->idx)) { |
1230 | vq_err(vq, "Failed to increment used idx"); | 1230 | vq_err(vq, "Failed to increment used idx"); |
1231 | return -EFAULT; | 1231 | return -EFAULT; |
1232 | } | 1232 | } |
@@ -1319,7 +1319,7 @@ void vhost_signal(struct vhost_dev *dev, struct vhost_virtqueue *vq) | |||
1319 | * interrupts. */ | 1319 | * interrupts. */ |
1320 | smp_mb(); | 1320 | smp_mb(); |
1321 | 1321 | ||
1322 | if (get_user(flags, &vq->avail->flags)) { | 1322 | if (__get_user(flags, &vq->avail->flags)) { |
1323 | vq_err(vq, "Failed to get flags"); | 1323 | vq_err(vq, "Failed to get flags"); |
1324 | return; | 1324 | return; |
1325 | } | 1325 | } |
@@ -1370,7 +1370,7 @@ bool vhost_enable_notify(struct vhost_virtqueue *vq) | |||
1370 | /* They could have slipped one in as we were doing that: make | 1370 | /* They could have slipped one in as we were doing that: make |
1371 | * sure it's written, then check again. */ | 1371 | * sure it's written, then check again. */ |
1372 | smp_mb(); | 1372 | smp_mb(); |
1373 | r = get_user(avail_idx, &vq->avail->idx); | 1373 | r = __get_user(avail_idx, &vq->avail->idx); |
1374 | if (r) { | 1374 | if (r) { |
1375 | vq_err(vq, "Failed to check avail idx at %p: %d\n", | 1375 | vq_err(vq, "Failed to check avail idx at %p: %d\n", |
1376 | &vq->avail->idx, r); | 1376 | &vq->avail->idx, r); |