OSDN Git Service

[media] v4l: Update v4l2 32bit structures
authorArun Menon <avmenon@codeaurora.org>
Wed, 5 Feb 2014 21:44:21 +0000 (13:44 -0800)
committerJeevan Shriram <jshriram@codeaurora.org>
Thu, 12 May 2016 00:44:10 +0000 (17:44 -0700)
Update v4l2_event32 structure with updated elements
from v4l2_event structure. Also copy and update
reserved and other fields during 32 bit ioctl handling.

CRs-Fixed: 1013345
Change-Id: I3038a2c0c7f2b7f13c412dc04890744d8dbe37ee
Signed-off-by: Arun Menon <avmenon@codeaurora.org>
drivers/media/v4l2-core/v4l2-compat-ioctl32.c

index 327e83a..fc9e439 100644 (file)
@@ -359,6 +359,10 @@ static int get_v4l2_plane32(struct v4l2_plane __user *up, struct v4l2_plane32 __
 
        if (copy_in_user(up, up32, 2 * sizeof(__u32)) ||
                copy_in_user(&up->data_offset, &up32->data_offset,
+                               sizeof(__u32)) ||
+               copy_in_user(up->reserved, up32->reserved,
+                               sizeof(up->reserved)) ||
+               copy_in_user(&up->length, &up32->length,
                                sizeof(__u32)))
                return -EFAULT;
 
@@ -384,6 +388,8 @@ static int put_v4l2_plane32(struct v4l2_plane __user *up, struct v4l2_plane32 __
                                enum v4l2_memory memory)
 {
        if (copy_in_user(up32, up, 2 * sizeof(__u32)) ||
+               copy_in_user(up32->reserved, up->reserved,
+                               sizeof(up32->reserved)) ||
                copy_in_user(&up32->data_offset, &up->data_offset,
                                sizeof(__u32)))
                return -EFAULT;
@@ -399,6 +405,10 @@ static int put_v4l2_plane32(struct v4l2_plane __user *up, struct v4l2_plane32 __
                if (copy_in_user(&up32->m.fd, &up->m.fd,
                                        sizeof(int)))
                        return -EFAULT;
+       if (memory == V4L2_MEMORY_USERPTR)
+               if (copy_in_user(&up32->m.userptr, &up->m.userptr,
+                                       sizeof(compat_long_t)))
+                       return -EFAULT;
 
        return 0;
 }
@@ -760,8 +770,13 @@ static int put_v4l2_ext_controls32(struct v4l2_ext_controls *kp, struct v4l2_ext
 struct v4l2_event32 {
        __u32                           type;
        union {
-               compat_s64              value64;
-               __u8                    data[64];
+               struct v4l2_event_vsync         vsync;
+               struct v4l2_event_ctrl          ctrl;
+               struct v4l2_event_frame_sync    frame_sync;
+               struct v4l2_event_src_change    src_change;
+               struct v4l2_event_motion_det    motion_det;
+                compat_s64                     value64;
+               __u8                            data[64];
        } u;
        __u32                           pending;
        __u32                           sequence;