mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 02:32:09 -04:00
Merge branch 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull misc vfs updates from Al Viro: "All kinds of misc stuff, without any unifying topic, from various people. Neil's d_anon patch, several bugfixes, introduction of kvmalloc analogue of kmemdup_user(), extending bitfield.h to deal with fixed-endians, assorted cleanups all over the place..." * 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (28 commits) alpha: osf_sys.c: use timespec64 where appropriate alpha: osf_sys.c: fix put_tv32 regression jffs2: Fix use-after-free bug in jffs2_iget()'s error handling path dcache: delete unused d_hash_mask dcache: subtract d_hash_shift from 32 in advance fs/buffer.c: fold init_buffer() into init_page_buffers() fs: fold __inode_permission() into inode_permission() fs: add RWF_APPEND sctp: use vmemdup_user() rather than badly open-coding memdup_user() snd_ctl_elem_init_enum_names(): switch to vmemdup_user() replace_user_tlv(): switch to vmemdup_user() new primitive: vmemdup_user() memdup_user(): switch to GFP_USER eventfd: fold eventfd_ctx_get() into eventfd_ctx_fileget() eventfd: fold eventfd_ctx_read() into eventfd_read() eventfd: convert to use anon_inode_getfd() nfs4file: get rid of pointless include of btrfs.h uvc_v4l2: clean copyin/copyout up vme_user: don't use __copy_..._user() usx2y: don't bother with memdup_user() for 16-byte structure ...
This commit is contained in:
commit
19e7b5f994
28 changed files with 298 additions and 405 deletions
|
|
@ -1284,36 +1284,30 @@ struct uvc_xu_control_mapping32 {
|
|||
static int uvc_v4l2_get_xu_mapping(struct uvc_xu_control_mapping *kp,
|
||||
const struct uvc_xu_control_mapping32 __user *up)
|
||||
{
|
||||
compat_caddr_t p;
|
||||
struct uvc_xu_control_mapping32 *p = (void *)kp;
|
||||
compat_caddr_t info;
|
||||
u32 count;
|
||||
|
||||
if (!access_ok(VERIFY_READ, up, sizeof(*up)) ||
|
||||
__copy_from_user(kp, up, offsetof(typeof(*up), menu_info)) ||
|
||||
__get_user(kp->menu_count, &up->menu_count))
|
||||
if (copy_from_user(p, up, sizeof(*p)))
|
||||
return -EFAULT;
|
||||
|
||||
count = p->menu_count;
|
||||
info = p->menu_info;
|
||||
|
||||
memset(kp->reserved, 0, sizeof(kp->reserved));
|
||||
|
||||
if (kp->menu_count == 0) {
|
||||
kp->menu_info = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (__get_user(p, &up->menu_info))
|
||||
return -EFAULT;
|
||||
kp->menu_info = compat_ptr(p);
|
||||
|
||||
kp->menu_info = count ? compat_ptr(info) : NULL;
|
||||
kp->menu_count = count;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int uvc_v4l2_put_xu_mapping(const struct uvc_xu_control_mapping *kp,
|
||||
struct uvc_xu_control_mapping32 __user *up)
|
||||
{
|
||||
if (!access_ok(VERIFY_WRITE, up, sizeof(*up)) ||
|
||||
__copy_to_user(up, kp, offsetof(typeof(*up), menu_info)) ||
|
||||
__put_user(kp->menu_count, &up->menu_count))
|
||||
if (copy_to_user(up, kp, offsetof(typeof(*up), menu_info)) ||
|
||||
put_user(kp->menu_count, &up->menu_count))
|
||||
return -EFAULT;
|
||||
|
||||
if (__clear_user(up->reserved, sizeof(up->reserved)))
|
||||
if (clear_user(up->reserved, sizeof(up->reserved)))
|
||||
return -EFAULT;
|
||||
|
||||
return 0;
|
||||
|
|
@ -1330,31 +1324,26 @@ struct uvc_xu_control_query32 {
|
|||
static int uvc_v4l2_get_xu_query(struct uvc_xu_control_query *kp,
|
||||
const struct uvc_xu_control_query32 __user *up)
|
||||
{
|
||||
compat_caddr_t p;
|
||||
struct uvc_xu_control_query32 v;
|
||||
|
||||
if (!access_ok(VERIFY_READ, up, sizeof(*up)) ||
|
||||
__copy_from_user(kp, up, offsetof(typeof(*up), data)))
|
||||
if (copy_from_user(&v, up, sizeof(v)))
|
||||
return -EFAULT;
|
||||
|
||||
if (kp->size == 0) {
|
||||
kp->data = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (__get_user(p, &up->data))
|
||||
return -EFAULT;
|
||||
kp->data = compat_ptr(p);
|
||||
|
||||
*kp = (struct uvc_xu_control_query){
|
||||
.unit = v.unit,
|
||||
.selector = v.selector,
|
||||
.query = v.query,
|
||||
.size = v.size,
|
||||
.data = v.size ? compat_ptr(v.data) : NULL
|
||||
};
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int uvc_v4l2_put_xu_query(const struct uvc_xu_control_query *kp,
|
||||
struct uvc_xu_control_query32 __user *up)
|
||||
{
|
||||
if (!access_ok(VERIFY_WRITE, up, sizeof(*up)) ||
|
||||
__copy_to_user(up, kp, offsetof(typeof(*up), data)))
|
||||
if (copy_to_user(up, kp, offsetof(typeof(*up), data)))
|
||||
return -EFAULT;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue