diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2013-05-16 19:35:21 -0400 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2013-05-19 20:54:22 -0400 |
commit | d2f83e9078b8114e3b9d09082856c1aac299aa37 (patch) | |
tree | 707f0d810d28e000eb3f9a775be880687dde1030 /net | |
parent | d5fe85af85367d5892e4308f596de4e2a5fb9017 (diff) |
Hoist memcpy_fromiovec/memcpy_toiovec into lib/
ERROR: "memcpy_fromiovec" [drivers/vhost/vhost_scsi.ko] undefined!
That function is only present with CONFIG_NET. Turns out that
crypto/algif_skcipher.c also uses that outside net, but it actually
needs sockets anyway.
In addition, commit 6d4f0139d642c45411a47879325891ce2a7c164a added
CONFIG_NET dependency to CONFIG_VMCI for memcpy_toiovec, so hoist
that function and revert that commit too.
socket.h already includes uio.h, so no callers need updating; trying
only broke things fo x86_64 randconfig (thanks Fengguang!).
Reported-by: Randy Dunlap <rdunlap@infradead.org>
Acked-by: David S. Miller <davem@davemloft.net>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'net')
-rw-r--r-- | net/core/iovec.c | 50 |
1 files changed, 0 insertions, 50 deletions
diff --git a/net/core/iovec.c b/net/core/iovec.c index 7e7aeb01de45..de178e462682 100644 --- a/net/core/iovec.c +++ b/net/core/iovec.c | |||
@@ -75,31 +75,6 @@ int verify_iovec(struct msghdr *m, struct iovec *iov, struct sockaddr_storage *a | |||
75 | 75 | ||
76 | /* | 76 | /* |
77 | * Copy kernel to iovec. Returns -EFAULT on error. | 77 | * Copy kernel to iovec. Returns -EFAULT on error. |
78 | * | ||
79 | * Note: this modifies the original iovec. | ||
80 | */ | ||
81 | |||
82 | int memcpy_toiovec(struct iovec *iov, unsigned char *kdata, int len) | ||
83 | { | ||
84 | while (len > 0) { | ||
85 | if (iov->iov_len) { | ||
86 | int copy = min_t(unsigned int, iov->iov_len, len); | ||
87 | if (copy_to_user(iov->iov_base, kdata, copy)) | ||
88 | return -EFAULT; | ||
89 | kdata += copy; | ||
90 | len -= copy; | ||
91 | iov->iov_len -= copy; | ||
92 | iov->iov_base += copy; | ||
93 | } | ||
94 | iov++; | ||
95 | } | ||
96 | |||
97 | return 0; | ||
98 | } | ||
99 | EXPORT_SYMBOL(memcpy_toiovec); | ||
100 | |||
101 | /* | ||
102 | * Copy kernel to iovec. Returns -EFAULT on error. | ||
103 | */ | 78 | */ |
104 | 79 | ||
105 | int memcpy_toiovecend(const struct iovec *iov, unsigned char *kdata, | 80 | int memcpy_toiovecend(const struct iovec *iov, unsigned char *kdata, |
@@ -125,31 +100,6 @@ int memcpy_toiovecend(const struct iovec *iov, unsigned char *kdata, | |||
125 | EXPORT_SYMBOL(memcpy_toiovecend); | 100 | EXPORT_SYMBOL(memcpy_toiovecend); |
126 | 101 | ||
127 | /* | 102 | /* |
128 | * Copy iovec to kernel. Returns -EFAULT on error. | ||
129 | * | ||
130 | * Note: this modifies the original iovec. | ||
131 | */ | ||
132 | |||
133 | int memcpy_fromiovec(unsigned char *kdata, struct iovec *iov, int len) | ||
134 | { | ||
135 | while (len > 0) { | ||
136 | if (iov->iov_len) { | ||
137 | int copy = min_t(unsigned int, len, iov->iov_len); | ||
138 | if (copy_from_user(kdata, iov->iov_base, copy)) | ||
139 | return -EFAULT; | ||
140 | len -= copy; | ||
141 | kdata += copy; | ||
142 | iov->iov_base += copy; | ||
143 | iov->iov_len -= copy; | ||
144 | } | ||
145 | iov++; | ||
146 | } | ||
147 | |||
148 | return 0; | ||
149 | } | ||
150 | EXPORT_SYMBOL(memcpy_fromiovec); | ||
151 | |||
152 | /* | ||
153 | * Copy iovec from kernel. Returns -EFAULT on error. | 103 | * Copy iovec from kernel. Returns -EFAULT on error. |
154 | */ | 104 | */ |
155 | 105 | ||