mirror of https://gitee.com/openkylin/linux.git
A build fix and a uapi exposure fix. The build fix is later than
I liked, but my first version broke linux-next due to overzealous header clean. Thanks, Rusty. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iQIcBAABAgAGBQJRnBctAAoJENkgDmzRrbjxymMP/ioTlABagJKNPvGPs4+j3rux uqd/qYImRGvEd/JzqQ3o2LWLUgMv/wPWjhpsaPTwNIgQYWp+u+YGtGVe73EYOEMR /Zy7MWsivva/p0MLmEKvWT8dgR88Nw0koxw+9zDUH0b5JIsH5vasG6hCQvumSNmW RRkgSqD+hQvIevG0sxLj6WXXX0Yh6bXteKy+MRJL+TMT//W+idFb3Y2OLDP8RgXy PPiJ5Qiw08sCIePXt9+rOgx6Qy2clQ70Y+1Vegr1pkTVreYxv/ERl4sOuy6pncGu z2IsNiVPFJG0hhalKjsyhJ0k/OrqlgDMWaj+Jh1iV+Iti6+4xco4fbQuAcEiVLm+ aml6ogpARI4Nc5lQIoZCVNGVEbp+NzDUIQi3ao6P59dZFcgYPApVwI6osYDV+SOE PjFf/HNYLogiO9rbOKCHxkvlUIr07eqB2RqVeSIdOkx/jrfFzGnJVFIge7LKO4ZM cOKw7qZAQgdUY/tZL+3ty4eCkg0WNjK6F4ORqIp7Vi6X2bMHLFAvG6oYDAZhcBGr ODZUt30fk1fYgoP1Kx3MFXJm6esOM3IdzpNmJY4hnV3Dx51w+5PNVYHE/RdXwqLh FvrDv2V5ZIuWoTY0HpYkl7Wld9Q1ZH9G2v+P936IR+exOuZKiRXkUjPPdAHSgQxs 1YWWoR3Up5ObU7LH6hL9 =rYZI -----END PGP SIGNATURE----- Merge tag 'fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux Pull virtio fixes from Rusty Russell: "A build fix and a uapi exposure fix. The build fix is later than I liked, but my first version broke linux-next due to overzealous header clean." * tag 'fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux: virtio_console: fix uapi header Hoist memcpy_fromiovec/memcpy_toiovec into lib/
This commit is contained in:
commit
94f1be9798
|
@ -4,7 +4,7 @@
|
|||
|
||||
config VMWARE_VMCI
|
||||
tristate "VMware VMCI Driver"
|
||||
depends on X86 && PCI && NET
|
||||
depends on X86 && PCI
|
||||
help
|
||||
This is VMware's Virtual Machine Communication Interface. It enables
|
||||
high-speed communication between host and guest in a virtual
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include <linux/pagemap.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/socket.h>
|
||||
#include <linux/uio.h>
|
||||
#include <linux/wait.h>
|
||||
#include <linux/vmalloc.h>
|
||||
|
||||
|
|
|
@ -305,7 +305,6 @@ struct ucred {
|
|||
|
||||
extern void cred_to_ucred(struct pid *pid, const struct cred *cred, struct ucred *ucred);
|
||||
|
||||
extern int memcpy_fromiovec(unsigned char *kdata, struct iovec *iov, int len);
|
||||
extern int memcpy_fromiovecend(unsigned char *kdata, const struct iovec *iov,
|
||||
int offset, int len);
|
||||
extern int csum_partial_copy_fromiovecend(unsigned char *kdata,
|
||||
|
@ -314,7 +313,6 @@ extern int csum_partial_copy_fromiovecend(unsigned char *kdata,
|
|||
unsigned int len, __wsum *csump);
|
||||
|
||||
extern int verify_iovec(struct msghdr *m, struct iovec *iov, struct sockaddr_storage *address, int mode);
|
||||
extern int memcpy_toiovec(struct iovec *v, unsigned char *kdata, int len);
|
||||
extern int memcpy_toiovecend(const struct iovec *v, unsigned char *kdata,
|
||||
int offset, int len);
|
||||
extern int move_addr_to_kernel(void __user *uaddr, int ulen, struct sockaddr_storage *kaddr);
|
||||
|
|
|
@ -35,4 +35,7 @@ static inline size_t iov_length(const struct iovec *iov, unsigned long nr_segs)
|
|||
}
|
||||
|
||||
unsigned long iov_shorten(struct iovec *iov, unsigned long nr_segs, size_t to);
|
||||
|
||||
int memcpy_fromiovec(unsigned char *kdata, struct iovec *iov, int len);
|
||||
int memcpy_toiovec(struct iovec *iov, unsigned char *kdata, int len);
|
||||
#endif
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
#define VIRTIO_CONSOLE_F_SIZE 0 /* Does host provide console size? */
|
||||
#define VIRTIO_CONSOLE_F_MULTIPORT 1 /* Does host provide multiple ports? */
|
||||
|
||||
#define VIRTIO_CONSOLE_BAD_ID (~(u32)0)
|
||||
#define VIRTIO_CONSOLE_BAD_ID (~(__u32)0)
|
||||
|
||||
struct virtio_console_config {
|
||||
/* colums of the screens */
|
||||
|
|
|
@ -9,7 +9,7 @@ endif
|
|||
|
||||
lib-y := ctype.o string.o vsprintf.o cmdline.o \
|
||||
rbtree.o radix-tree.o dump_stack.o timerqueue.o\
|
||||
idr.o int_sqrt.o extable.o \
|
||||
idr.o int_sqrt.o extable.o iovec.o \
|
||||
sha1.o md5.o irq_regs.o reciprocal_div.o argv_split.o \
|
||||
proportions.o flex_proportions.o prio_heap.o ratelimit.o show_mem.o \
|
||||
is_single_threaded.o plist.o decompress.o kobject_uevent.o \
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
#include <linux/uaccess.h>
|
||||
#include <linux/export.h>
|
||||
#include <linux/uio.h>
|
||||
|
||||
/*
|
||||
* Copy iovec to kernel. Returns -EFAULT on error.
|
||||
*
|
||||
* Note: this modifies the original iovec.
|
||||
*/
|
||||
|
||||
int memcpy_fromiovec(unsigned char *kdata, struct iovec *iov, int len)
|
||||
{
|
||||
while (len > 0) {
|
||||
if (iov->iov_len) {
|
||||
int copy = min_t(unsigned int, len, iov->iov_len);
|
||||
if (copy_from_user(kdata, iov->iov_base, copy))
|
||||
return -EFAULT;
|
||||
len -= copy;
|
||||
kdata += copy;
|
||||
iov->iov_base += copy;
|
||||
iov->iov_len -= copy;
|
||||
}
|
||||
iov++;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(memcpy_fromiovec);
|
||||
|
||||
/*
|
||||
* Copy kernel to iovec. Returns -EFAULT on error.
|
||||
*
|
||||
* Note: this modifies the original iovec.
|
||||
*/
|
||||
|
||||
int memcpy_toiovec(struct iovec *iov, unsigned char *kdata, int len)
|
||||
{
|
||||
while (len > 0) {
|
||||
if (iov->iov_len) {
|
||||
int copy = min_t(unsigned int, iov->iov_len, len);
|
||||
if (copy_to_user(iov->iov_base, kdata, copy))
|
||||
return -EFAULT;
|
||||
kdata += copy;
|
||||
len -= copy;
|
||||
iov->iov_len -= copy;
|
||||
iov->iov_base += copy;
|
||||
}
|
||||
iov++;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(memcpy_toiovec);
|
|
@ -73,31 +73,6 @@ int verify_iovec(struct msghdr *m, struct iovec *iov, struct sockaddr_storage *a
|
|||
return err;
|
||||
}
|
||||
|
||||
/*
|
||||
* Copy kernel to iovec. Returns -EFAULT on error.
|
||||
*
|
||||
* Note: this modifies the original iovec.
|
||||
*/
|
||||
|
||||
int memcpy_toiovec(struct iovec *iov, unsigned char *kdata, int len)
|
||||
{
|
||||
while (len > 0) {
|
||||
if (iov->iov_len) {
|
||||
int copy = min_t(unsigned int, iov->iov_len, len);
|
||||
if (copy_to_user(iov->iov_base, kdata, copy))
|
||||
return -EFAULT;
|
||||
kdata += copy;
|
||||
len -= copy;
|
||||
iov->iov_len -= copy;
|
||||
iov->iov_base += copy;
|
||||
}
|
||||
iov++;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(memcpy_toiovec);
|
||||
|
||||
/*
|
||||
* Copy kernel to iovec. Returns -EFAULT on error.
|
||||
*/
|
||||
|
@ -124,31 +99,6 @@ int memcpy_toiovecend(const struct iovec *iov, unsigned char *kdata,
|
|||
}
|
||||
EXPORT_SYMBOL(memcpy_toiovecend);
|
||||
|
||||
/*
|
||||
* Copy iovec to kernel. Returns -EFAULT on error.
|
||||
*
|
||||
* Note: this modifies the original iovec.
|
||||
*/
|
||||
|
||||
int memcpy_fromiovec(unsigned char *kdata, struct iovec *iov, int len)
|
||||
{
|
||||
while (len > 0) {
|
||||
if (iov->iov_len) {
|
||||
int copy = min_t(unsigned int, len, iov->iov_len);
|
||||
if (copy_from_user(kdata, iov->iov_base, copy))
|
||||
return -EFAULT;
|
||||
len -= copy;
|
||||
kdata += copy;
|
||||
iov->iov_base += copy;
|
||||
iov->iov_len -= copy;
|
||||
}
|
||||
iov++;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(memcpy_fromiovec);
|
||||
|
||||
/*
|
||||
* Copy iovec from kernel. Returns -EFAULT on error.
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue