diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2014-12-10 16:03:43 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2015-02-04 01:34:16 -0500 |
commit | 57dd8a0735aabff4862025cf64ad94da3d80e620 (patch) | |
tree | 6cce47f1276bc51e1eb29e8cd623e78102ff4c6a /lib | |
parent | ba7438aed924133df54a60e4cd5499d359bcf2a8 (diff) |
vhost: vhost_scsi_handle_vq() should just use copy_from_user()
it has just verified that it asks no more than the length of the
first segment of iovec.
And with that the last user of stuff in lib/iovec.c is gone.
RIP.
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Nicholas A. Bellinger <nab@linux-iscsi.org>
Cc: kvm@vger.kernel.org
Cc: virtualization@lists.linux-foundation.org
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Makefile | 2 | ||||
-rw-r--r-- | lib/iovec.c | 36 |
2 files changed, 1 insertions, 37 deletions
diff --git a/lib/Makefile b/lib/Makefile index 3c3b30b9e020..1071d06398c3 100644 --- a/lib/Makefile +++ b/lib/Makefile | |||
@@ -24,7 +24,7 @@ obj-y += lockref.o | |||
24 | 24 | ||
25 | obj-y += bcd.o div64.o sort.o parser.o halfmd4.o debug_locks.o random32.o \ | 25 | obj-y += bcd.o div64.o sort.o parser.o halfmd4.o debug_locks.o random32.o \ |
26 | bust_spinlocks.o hexdump.o kasprintf.o bitmap.o scatterlist.o \ | 26 | bust_spinlocks.o hexdump.o kasprintf.o bitmap.o scatterlist.o \ |
27 | gcd.o lcm.o list_sort.o uuid.o flex_array.o iovec.o clz_ctz.o \ | 27 | gcd.o lcm.o list_sort.o uuid.o flex_array.o clz_ctz.o \ |
28 | bsearch.o find_last_bit.o find_next_bit.o llist.o memweight.o kfifo.o \ | 28 | bsearch.o find_last_bit.o find_next_bit.o llist.o memweight.o kfifo.o \ |
29 | percpu-refcount.o percpu_ida.o rhashtable.o reciprocal_div.o | 29 | percpu-refcount.o percpu_ida.o rhashtable.o reciprocal_div.o |
30 | obj-y += string_helpers.o | 30 | obj-y += string_helpers.o |
diff --git a/lib/iovec.c b/lib/iovec.c deleted file mode 100644 index d8f17a9b1ccf..000000000000 --- a/lib/iovec.c +++ /dev/null | |||
@@ -1,36 +0,0 @@ | |||
1 | #include <linux/uaccess.h> | ||
2 | #include <linux/export.h> | ||
3 | #include <linux/uio.h> | ||
4 | |||
5 | /* | ||
6 | * Copy iovec to kernel. Returns -EFAULT on error. | ||
7 | */ | ||
8 | |||
9 | int memcpy_fromiovecend(unsigned char *kdata, const struct iovec *iov, | ||
10 | int offset, int len) | ||
11 | { | ||
12 | /* No data? Done! */ | ||
13 | if (len == 0) | ||
14 | return 0; | ||
15 | |||
16 | /* Skip over the finished iovecs */ | ||
17 | while (offset >= iov->iov_len) { | ||
18 | offset -= iov->iov_len; | ||
19 | iov++; | ||
20 | } | ||
21 | |||
22 | while (len > 0) { | ||
23 | u8 __user *base = iov->iov_base + offset; | ||
24 | int copy = min_t(unsigned int, len, iov->iov_len - offset); | ||
25 | |||
26 | offset = 0; | ||
27 | if (copy_from_user(kdata, base, copy)) | ||
28 | return -EFAULT; | ||
29 | len -= copy; | ||
30 | kdata += copy; | ||
31 | iov++; | ||
32 | } | ||
33 | |||
34 | return 0; | ||
35 | } | ||
36 | EXPORT_SYMBOL(memcpy_fromiovecend); | ||