Commit daff4d00 authored by Hans Verkuil's avatar Hans Verkuil Committed by Greg Kroah-Hartman

media: v4l2-compat-ioctl32.c: avoid sizeof(type)

commit 333b1e9f upstream.

Instead of doing sizeof(struct foo) use sizeof(*up). There even were
cases where 4 * sizeof(__u32) was used instead of sizeof(kp->reserved),
which is very dangerous when the size of the reserved array changes.
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Acked-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 81e0acf0
...@@ -47,7 +47,7 @@ struct v4l2_window32 { ...@@ -47,7 +47,7 @@ struct v4l2_window32 {
static int get_v4l2_window32(struct v4l2_window *kp, struct v4l2_window32 __user *up) static int get_v4l2_window32(struct v4l2_window *kp, struct v4l2_window32 __user *up)
{ {
if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_window32)) || if (!access_ok(VERIFY_READ, up, sizeof(*up)) ||
copy_from_user(&kp->w, &up->w, sizeof(up->w)) || copy_from_user(&kp->w, &up->w, sizeof(up->w)) ||
get_user(kp->field, &up->field) || get_user(kp->field, &up->field) ||
get_user(kp->chromakey, &up->chromakey) || get_user(kp->chromakey, &up->chromakey) ||
...@@ -64,7 +64,7 @@ static int get_v4l2_window32(struct v4l2_window *kp, struct v4l2_window32 __user ...@@ -64,7 +64,7 @@ static int get_v4l2_window32(struct v4l2_window *kp, struct v4l2_window32 __user
if (get_user(p, &up->clips)) if (get_user(p, &up->clips))
return -EFAULT; return -EFAULT;
uclips = compat_ptr(p); uclips = compat_ptr(p);
kclips = compat_alloc_user_space(n * sizeof(struct v4l2_clip)); kclips = compat_alloc_user_space(n * sizeof(*kclips));
kp->clips = kclips; kp->clips = kclips;
while (--n >= 0) { while (--n >= 0) {
if (copy_in_user(&kclips->c, &uclips->c, sizeof(uclips->c))) if (copy_in_user(&kclips->c, &uclips->c, sizeof(uclips->c)))
...@@ -157,14 +157,14 @@ static int __get_v4l2_format32(struct v4l2_format *kp, struct v4l2_format32 __us ...@@ -157,14 +157,14 @@ static int __get_v4l2_format32(struct v4l2_format *kp, struct v4l2_format32 __us
static int get_v4l2_format32(struct v4l2_format *kp, struct v4l2_format32 __user *up) static int get_v4l2_format32(struct v4l2_format *kp, struct v4l2_format32 __user *up)
{ {
if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_format32))) if (!access_ok(VERIFY_READ, up, sizeof(*up)))
return -EFAULT; return -EFAULT;
return __get_v4l2_format32(kp, up); return __get_v4l2_format32(kp, up);
} }
static int get_v4l2_create32(struct v4l2_create_buffers *kp, struct v4l2_create_buffers32 __user *up) static int get_v4l2_create32(struct v4l2_create_buffers *kp, struct v4l2_create_buffers32 __user *up)
{ {
if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_create_buffers32)) || if (!access_ok(VERIFY_READ, up, sizeof(*up)) ||
copy_from_user(kp, up, offsetof(struct v4l2_create_buffers32, format))) copy_from_user(kp, up, offsetof(struct v4l2_create_buffers32, format)))
return -EFAULT; return -EFAULT;
return __get_v4l2_format32(&kp->format, &up->format); return __get_v4l2_format32(&kp->format, &up->format);
...@@ -208,14 +208,14 @@ static int __put_v4l2_format32(struct v4l2_format *kp, struct v4l2_format32 __us ...@@ -208,14 +208,14 @@ static int __put_v4l2_format32(struct v4l2_format *kp, struct v4l2_format32 __us
static int put_v4l2_format32(struct v4l2_format *kp, struct v4l2_format32 __user *up) static int put_v4l2_format32(struct v4l2_format *kp, struct v4l2_format32 __user *up)
{ {
if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_format32))) if (!access_ok(VERIFY_WRITE, up, sizeof(*up)))
return -EFAULT; return -EFAULT;
return __put_v4l2_format32(kp, up); return __put_v4l2_format32(kp, up);
} }
static int put_v4l2_create32(struct v4l2_create_buffers *kp, struct v4l2_create_buffers32 __user *up) static int put_v4l2_create32(struct v4l2_create_buffers *kp, struct v4l2_create_buffers32 __user *up)
{ {
if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_create_buffers32)) || if (!access_ok(VERIFY_WRITE, up, sizeof(*up)) ||
copy_to_user(up, kp, offsetof(struct v4l2_create_buffers32, format)) || copy_to_user(up, kp, offsetof(struct v4l2_create_buffers32, format)) ||
copy_to_user(up->reserved, kp->reserved, sizeof(kp->reserved))) copy_to_user(up->reserved, kp->reserved, sizeof(kp->reserved)))
return -EFAULT; return -EFAULT;
...@@ -234,7 +234,7 @@ struct v4l2_standard32 { ...@@ -234,7 +234,7 @@ struct v4l2_standard32 {
static int get_v4l2_standard32(struct v4l2_standard *kp, struct v4l2_standard32 __user *up) static int get_v4l2_standard32(struct v4l2_standard *kp, struct v4l2_standard32 __user *up)
{ {
/* other fields are not set by the user, nor used by the driver */ /* other fields are not set by the user, nor used by the driver */
if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_standard32)) || if (!access_ok(VERIFY_READ, up, sizeof(*up)) ||
get_user(kp->index, &up->index)) get_user(kp->index, &up->index))
return -EFAULT; return -EFAULT;
return 0; return 0;
...@@ -242,13 +242,13 @@ static int get_v4l2_standard32(struct v4l2_standard *kp, struct v4l2_standard32 ...@@ -242,13 +242,13 @@ static int get_v4l2_standard32(struct v4l2_standard *kp, struct v4l2_standard32
static int put_v4l2_standard32(struct v4l2_standard *kp, struct v4l2_standard32 __user *up) static int put_v4l2_standard32(struct v4l2_standard *kp, struct v4l2_standard32 __user *up)
{ {
if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_standard32)) || if (!access_ok(VERIFY_WRITE, up, sizeof(*up)) ||
put_user(kp->index, &up->index) || put_user(kp->index, &up->index) ||
put_user(kp->id, &up->id) || put_user(kp->id, &up->id) ||
copy_to_user(up->name, kp->name, 24) || copy_to_user(up->name, kp->name, sizeof(up->name)) ||
copy_to_user(&up->frameperiod, &kp->frameperiod, sizeof(kp->frameperiod)) || copy_to_user(&up->frameperiod, &kp->frameperiod, sizeof(kp->frameperiod)) ||
put_user(kp->framelines, &up->framelines) || put_user(kp->framelines, &up->framelines) ||
copy_to_user(up->reserved, kp->reserved, 4 * sizeof(__u32))) copy_to_user(up->reserved, kp->reserved, sizeof(kp->reserved)))
return -EFAULT; return -EFAULT;
return 0; return 0;
} }
...@@ -296,7 +296,7 @@ static int get_v4l2_plane32(struct v4l2_plane __user *up, struct v4l2_plane32 __ ...@@ -296,7 +296,7 @@ static int get_v4l2_plane32(struct v4l2_plane __user *up, struct v4l2_plane32 __
if (copy_in_user(up, up32, 2 * sizeof(__u32)) || if (copy_in_user(up, up32, 2 * sizeof(__u32)) ||
copy_in_user(&up->data_offset, &up32->data_offset, copy_in_user(&up->data_offset, &up32->data_offset,
sizeof(__u32))) sizeof(up->data_offset)))
return -EFAULT; return -EFAULT;
if (memory == V4L2_MEMORY_USERPTR) { if (memory == V4L2_MEMORY_USERPTR) {
...@@ -306,11 +306,11 @@ static int get_v4l2_plane32(struct v4l2_plane __user *up, struct v4l2_plane32 __ ...@@ -306,11 +306,11 @@ static int get_v4l2_plane32(struct v4l2_plane __user *up, struct v4l2_plane32 __
if (put_user((unsigned long)up_pln, &up->m.userptr)) if (put_user((unsigned long)up_pln, &up->m.userptr))
return -EFAULT; return -EFAULT;
} else if (memory == V4L2_MEMORY_DMABUF) { } else if (memory == V4L2_MEMORY_DMABUF) {
if (copy_in_user(&up->m.fd, &up32->m.fd, sizeof(int))) if (copy_in_user(&up->m.fd, &up32->m.fd, sizeof(up32->m.fd)))
return -EFAULT; return -EFAULT;
} else { } else {
if (copy_in_user(&up->m.mem_offset, &up32->m.mem_offset, if (copy_in_user(&up->m.mem_offset, &up32->m.mem_offset,
sizeof(__u32))) sizeof(up32->m.mem_offset)))
return -EFAULT; return -EFAULT;
} }
...@@ -322,19 +322,19 @@ static int put_v4l2_plane32(struct v4l2_plane __user *up, struct v4l2_plane32 __ ...@@ -322,19 +322,19 @@ static int put_v4l2_plane32(struct v4l2_plane __user *up, struct v4l2_plane32 __
{ {
if (copy_in_user(up32, up, 2 * sizeof(__u32)) || if (copy_in_user(up32, up, 2 * sizeof(__u32)) ||
copy_in_user(&up32->data_offset, &up->data_offset, copy_in_user(&up32->data_offset, &up->data_offset,
sizeof(__u32))) sizeof(up->data_offset)))
return -EFAULT; return -EFAULT;
/* For MMAP, driver might've set up the offset, so copy it back. /* For MMAP, driver might've set up the offset, so copy it back.
* USERPTR stays the same (was userspace-provided), so no copying. */ * USERPTR stays the same (was userspace-provided), so no copying. */
if (memory == V4L2_MEMORY_MMAP) if (memory == V4L2_MEMORY_MMAP)
if (copy_in_user(&up32->m.mem_offset, &up->m.mem_offset, if (copy_in_user(&up32->m.mem_offset, &up->m.mem_offset,
sizeof(__u32))) sizeof(up->m.mem_offset)))
return -EFAULT; return -EFAULT;
/* For DMABUF, driver might've set up the fd, so copy it back. */ /* For DMABUF, driver might've set up the fd, so copy it back. */
if (memory == V4L2_MEMORY_DMABUF) if (memory == V4L2_MEMORY_DMABUF)
if (copy_in_user(&up32->m.fd, &up->m.fd, if (copy_in_user(&up32->m.fd, &up->m.fd,
sizeof(int))) sizeof(up->m.fd)))
return -EFAULT; return -EFAULT;
return 0; return 0;
...@@ -348,7 +348,7 @@ static int get_v4l2_buffer32(struct v4l2_buffer *kp, struct v4l2_buffer32 __user ...@@ -348,7 +348,7 @@ static int get_v4l2_buffer32(struct v4l2_buffer *kp, struct v4l2_buffer32 __user
int num_planes; int num_planes;
int ret; int ret;
if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_buffer32)) || if (!access_ok(VERIFY_READ, up, sizeof(*up)) ||
get_user(kp->index, &up->index) || get_user(kp->index, &up->index) ||
get_user(kp->type, &up->type) || get_user(kp->type, &up->type) ||
get_user(kp->flags, &up->flags) || get_user(kp->flags, &up->flags) ||
...@@ -360,8 +360,7 @@ static int get_v4l2_buffer32(struct v4l2_buffer *kp, struct v4l2_buffer32 __user ...@@ -360,8 +360,7 @@ static int get_v4l2_buffer32(struct v4l2_buffer *kp, struct v4l2_buffer32 __user
if (get_user(kp->bytesused, &up->bytesused) || if (get_user(kp->bytesused, &up->bytesused) ||
get_user(kp->field, &up->field) || get_user(kp->field, &up->field) ||
get_user(kp->timestamp.tv_sec, &up->timestamp.tv_sec) || get_user(kp->timestamp.tv_sec, &up->timestamp.tv_sec) ||
get_user(kp->timestamp.tv_usec, get_user(kp->timestamp.tv_usec, &up->timestamp.tv_usec))
&up->timestamp.tv_usec))
return -EFAULT; return -EFAULT;
if (V4L2_TYPE_IS_MULTIPLANAR(kp->type)) { if (V4L2_TYPE_IS_MULTIPLANAR(kp->type)) {
...@@ -378,13 +377,12 @@ static int get_v4l2_buffer32(struct v4l2_buffer *kp, struct v4l2_buffer32 __user ...@@ -378,13 +377,12 @@ static int get_v4l2_buffer32(struct v4l2_buffer *kp, struct v4l2_buffer32 __user
uplane32 = compat_ptr(p); uplane32 = compat_ptr(p);
if (!access_ok(VERIFY_READ, uplane32, if (!access_ok(VERIFY_READ, uplane32,
num_planes * sizeof(struct v4l2_plane32))) num_planes * sizeof(*uplane32)))
return -EFAULT; return -EFAULT;
/* We don't really care if userspace decides to kill itself /* We don't really care if userspace decides to kill itself
* by passing a very big num_planes value */ * by passing a very big num_planes value */
uplane = compat_alloc_user_space(num_planes * uplane = compat_alloc_user_space(num_planes * sizeof(*uplane));
sizeof(struct v4l2_plane));
kp->m.planes = (__force struct v4l2_plane *)uplane; kp->m.planes = (__force struct v4l2_plane *)uplane;
while (--num_planes >= 0) { while (--num_planes >= 0) {
...@@ -432,7 +430,7 @@ static int put_v4l2_buffer32(struct v4l2_buffer *kp, struct v4l2_buffer32 __user ...@@ -432,7 +430,7 @@ static int put_v4l2_buffer32(struct v4l2_buffer *kp, struct v4l2_buffer32 __user
int num_planes; int num_planes;
int ret; int ret;
if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_buffer32)) || if (!access_ok(VERIFY_WRITE, up, sizeof(*up)) ||
put_user(kp->index, &up->index) || put_user(kp->index, &up->index) ||
put_user(kp->type, &up->type) || put_user(kp->type, &up->type) ||
put_user(kp->flags, &up->flags) || put_user(kp->flags, &up->flags) ||
...@@ -443,7 +441,7 @@ static int put_v4l2_buffer32(struct v4l2_buffer *kp, struct v4l2_buffer32 __user ...@@ -443,7 +441,7 @@ static int put_v4l2_buffer32(struct v4l2_buffer *kp, struct v4l2_buffer32 __user
put_user(kp->field, &up->field) || put_user(kp->field, &up->field) ||
put_user(kp->timestamp.tv_sec, &up->timestamp.tv_sec) || put_user(kp->timestamp.tv_sec, &up->timestamp.tv_sec) ||
put_user(kp->timestamp.tv_usec, &up->timestamp.tv_usec) || put_user(kp->timestamp.tv_usec, &up->timestamp.tv_usec) ||
copy_to_user(&up->timecode, &kp->timecode, sizeof(struct v4l2_timecode)) || copy_to_user(&up->timecode, &kp->timecode, sizeof(kp->timecode)) ||
put_user(kp->sequence, &up->sequence) || put_user(kp->sequence, &up->sequence) ||
put_user(kp->reserved2, &up->reserved2) || put_user(kp->reserved2, &up->reserved2) ||
put_user(kp->reserved, &up->reserved) || put_user(kp->reserved, &up->reserved) ||
...@@ -511,7 +509,7 @@ static int get_v4l2_framebuffer32(struct v4l2_framebuffer *kp, struct v4l2_frame ...@@ -511,7 +509,7 @@ static int get_v4l2_framebuffer32(struct v4l2_framebuffer *kp, struct v4l2_frame
{ {
u32 tmp; u32 tmp;
if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_framebuffer32)) || if (!access_ok(VERIFY_READ, up, sizeof(*up)) ||
get_user(tmp, &up->base) || get_user(tmp, &up->base) ||
get_user(kp->capability, &up->capability) || get_user(kp->capability, &up->capability) ||
get_user(kp->flags, &up->flags) || get_user(kp->flags, &up->flags) ||
...@@ -525,7 +523,7 @@ static int put_v4l2_framebuffer32(struct v4l2_framebuffer *kp, struct v4l2_frame ...@@ -525,7 +523,7 @@ static int put_v4l2_framebuffer32(struct v4l2_framebuffer *kp, struct v4l2_frame
{ {
u32 tmp = (u32)((unsigned long)kp->base); u32 tmp = (u32)((unsigned long)kp->base);
if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_framebuffer32)) || if (!access_ok(VERIFY_WRITE, up, sizeof(*up)) ||
put_user(tmp, &up->base) || put_user(tmp, &up->base) ||
put_user(kp->capability, &up->capability) || put_user(kp->capability, &up->capability) ||
put_user(kp->flags, &up->flags) || put_user(kp->flags, &up->flags) ||
...@@ -549,14 +547,14 @@ struct v4l2_input32 { ...@@ -549,14 +547,14 @@ struct v4l2_input32 {
Otherwise it is identical to the 32-bit version. */ Otherwise it is identical to the 32-bit version. */
static inline int get_v4l2_input32(struct v4l2_input *kp, struct v4l2_input32 __user *up) static inline int get_v4l2_input32(struct v4l2_input *kp, struct v4l2_input32 __user *up)
{ {
if (copy_from_user(kp, up, sizeof(struct v4l2_input32))) if (copy_from_user(kp, up, sizeof(*up)))
return -EFAULT; return -EFAULT;
return 0; return 0;
} }
static inline int put_v4l2_input32(struct v4l2_input *kp, struct v4l2_input32 __user *up) static inline int put_v4l2_input32(struct v4l2_input *kp, struct v4l2_input32 __user *up)
{ {
if (copy_to_user(up, kp, sizeof(struct v4l2_input32))) if (copy_to_user(up, kp, sizeof(*up)))
return -EFAULT; return -EFAULT;
return 0; return 0;
} }
...@@ -604,12 +602,11 @@ static int get_v4l2_ext_controls32(struct v4l2_ext_controls *kp, struct v4l2_ext ...@@ -604,12 +602,11 @@ static int get_v4l2_ext_controls32(struct v4l2_ext_controls *kp, struct v4l2_ext
int n; int n;
compat_caddr_t p; compat_caddr_t p;
if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_ext_controls32)) || if (!access_ok(VERIFY_READ, up, sizeof(*up)) ||
get_user(kp->which, &up->which) || get_user(kp->which, &up->which) ||
get_user(kp->count, &up->count) || get_user(kp->count, &up->count) ||
get_user(kp->error_idx, &up->error_idx) || get_user(kp->error_idx, &up->error_idx) ||
copy_from_user(kp->reserved, up->reserved, copy_from_user(kp->reserved, up->reserved, sizeof(kp->reserved)))
sizeof(kp->reserved)))
return -EFAULT; return -EFAULT;
n = kp->count; n = kp->count;
if (n == 0) { if (n == 0) {
...@@ -619,10 +616,9 @@ static int get_v4l2_ext_controls32(struct v4l2_ext_controls *kp, struct v4l2_ext ...@@ -619,10 +616,9 @@ static int get_v4l2_ext_controls32(struct v4l2_ext_controls *kp, struct v4l2_ext
if (get_user(p, &up->controls)) if (get_user(p, &up->controls))
return -EFAULT; return -EFAULT;
ucontrols = compat_ptr(p); ucontrols = compat_ptr(p);
if (!access_ok(VERIFY_READ, ucontrols, if (!access_ok(VERIFY_READ, ucontrols, n * sizeof(*ucontrols)))
n * sizeof(struct v4l2_ext_control32)))
return -EFAULT; return -EFAULT;
kcontrols = compat_alloc_user_space(n * sizeof(struct v4l2_ext_control)); kcontrols = compat_alloc_user_space(n * sizeof(*kcontrols));
kp->controls = (__force struct v4l2_ext_control *)kcontrols; kp->controls = (__force struct v4l2_ext_control *)kcontrols;
while (--n >= 0) { while (--n >= 0) {
u32 id; u32 id;
...@@ -654,7 +650,7 @@ static int put_v4l2_ext_controls32(struct v4l2_ext_controls *kp, struct v4l2_ext ...@@ -654,7 +650,7 @@ static int put_v4l2_ext_controls32(struct v4l2_ext_controls *kp, struct v4l2_ext
int n = kp->count; int n = kp->count;
compat_caddr_t p; compat_caddr_t p;
if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_ext_controls32)) || if (!access_ok(VERIFY_WRITE, up, sizeof(*up)) ||
put_user(kp->which, &up->which) || put_user(kp->which, &up->which) ||
put_user(kp->count, &up->count) || put_user(kp->count, &up->count) ||
put_user(kp->error_idx, &up->error_idx) || put_user(kp->error_idx, &up->error_idx) ||
...@@ -666,8 +662,7 @@ static int put_v4l2_ext_controls32(struct v4l2_ext_controls *kp, struct v4l2_ext ...@@ -666,8 +662,7 @@ static int put_v4l2_ext_controls32(struct v4l2_ext_controls *kp, struct v4l2_ext
if (get_user(p, &up->controls)) if (get_user(p, &up->controls))
return -EFAULT; return -EFAULT;
ucontrols = compat_ptr(p); ucontrols = compat_ptr(p);
if (!access_ok(VERIFY_WRITE, ucontrols, if (!access_ok(VERIFY_WRITE, ucontrols, n * sizeof(*ucontrols)))
n * sizeof(struct v4l2_ext_control32)))
return -EFAULT; return -EFAULT;
while (--n >= 0) { while (--n >= 0) {
...@@ -704,7 +699,7 @@ struct v4l2_event32 { ...@@ -704,7 +699,7 @@ struct v4l2_event32 {
static int put_v4l2_event32(struct v4l2_event *kp, struct v4l2_event32 __user *up) static int put_v4l2_event32(struct v4l2_event *kp, struct v4l2_event32 __user *up)
{ {
if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_event32)) || if (!access_ok(VERIFY_WRITE, up, sizeof(*up)) ||
put_user(kp->type, &up->type) || put_user(kp->type, &up->type) ||
copy_to_user(&up->u, &kp->u, sizeof(kp->u)) || copy_to_user(&up->u, &kp->u, sizeof(kp->u)) ||
put_user(kp->pending, &up->pending) || put_user(kp->pending, &up->pending) ||
...@@ -712,7 +707,7 @@ static int put_v4l2_event32(struct v4l2_event *kp, struct v4l2_event32 __user *u ...@@ -712,7 +707,7 @@ static int put_v4l2_event32(struct v4l2_event *kp, struct v4l2_event32 __user *u
put_user(kp->timestamp.tv_sec, &up->timestamp.tv_sec) || put_user(kp->timestamp.tv_sec, &up->timestamp.tv_sec) ||
put_user(kp->timestamp.tv_nsec, &up->timestamp.tv_nsec) || put_user(kp->timestamp.tv_nsec, &up->timestamp.tv_nsec) ||
put_user(kp->id, &up->id) || put_user(kp->id, &up->id) ||
copy_to_user(up->reserved, kp->reserved, 8 * sizeof(__u32))) copy_to_user(up->reserved, kp->reserved, sizeof(kp->reserved)))
return -EFAULT; return -EFAULT;
return 0; return 0;
} }
...@@ -729,7 +724,7 @@ static int get_v4l2_edid32(struct v4l2_edid *kp, struct v4l2_edid32 __user *up) ...@@ -729,7 +724,7 @@ static int get_v4l2_edid32(struct v4l2_edid *kp, struct v4l2_edid32 __user *up)
{ {
u32 tmp; u32 tmp;
if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_edid32)) || if (!access_ok(VERIFY_READ, up, sizeof(*up)) ||
get_user(kp->pad, &up->pad) || get_user(kp->pad, &up->pad) ||
get_user(kp->start_block, &up->start_block) || get_user(kp->start_block, &up->start_block) ||
get_user(kp->blocks, &up->blocks) || get_user(kp->blocks, &up->blocks) ||
...@@ -744,7 +739,7 @@ static int put_v4l2_edid32(struct v4l2_edid *kp, struct v4l2_edid32 __user *up) ...@@ -744,7 +739,7 @@ static int put_v4l2_edid32(struct v4l2_edid *kp, struct v4l2_edid32 __user *up)
{ {
u32 tmp = (u32)((unsigned long)kp->edid); u32 tmp = (u32)((unsigned long)kp->edid);
if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_edid32)) || if (!access_ok(VERIFY_WRITE, up, sizeof(*up)) ||
put_user(kp->pad, &up->pad) || put_user(kp->pad, &up->pad) ||
put_user(kp->start_block, &up->start_block) || put_user(kp->start_block, &up->start_block) ||
put_user(kp->blocks, &up->blocks) || put_user(kp->blocks, &up->blocks) ||
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment