media: v4l2-compat-ioctl32: initialize a reserved field 93/175693/1
authorMauro Carvalho Chehab <mchehab@s-opensource.com>
Wed, 28 Mar 2018 18:12:37 +0000 (15:12 -0300)
committerSeung-Woo Kim <sw0312.kim@samsung.com>
Wed, 11 Apr 2018 11:59:20 +0000 (20:59 +0900)
The get_v4l2_create32() function is missing a logic with
would be cleaning a reserved field, causing v4l2-compliance
to complain:

 Buffer ioctls (Input 0):
fail: v4l2-test-buffers.cpp(506): check_0(crbufs.reserved, sizeof(crbufs.reserved))
test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: FAIL

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[sw0312.kim: cherry-pick from linux-3.18.y]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: I460dc03643f4217adbfe4d8271ab4c917ab8a269

drivers/media/v4l2-core/v4l2-compat-ioctl32.c

index 3e786d5cd950dc37c17300d096863164b7e580bb..60bee315fd03831c5ca38e78907a5fc82f6c7902 100644 (file)
@@ -247,7 +247,8 @@ static int get_v4l2_create32(struct v4l2_create_buffers __user *kp,
 {
        if (!access_ok(VERIFY_READ, up, sizeof(*up)) ||
            copy_in_user(kp, up,
-                        offsetof(struct v4l2_create_buffers32, format)))
+                        offsetof(struct v4l2_create_buffers32, format)) ||
+           copy_in_user(kp->reserved, up->reserved, sizeof(kp->reserved)))
                return -EFAULT;
        return __get_v4l2_format32(&kp->format, &up->format,
                                   aux_buf, aux_space);