diff options
author | Hans Verkuil <hans.verkuil@cisco.com> | 2018-01-24 04:35:48 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2018-01-30 07:25:34 -0500 |
commit | b7b957d429f601d6d1942122b339474f31191d75 (patch) | |
tree | e47783112b3192fc5f27fe11cf965edf370cb01c | |
parent | 3ee6d040719ae09110e5cdf24d5386abe5d1b776 (diff) |
media: v4l2-compat-ioctl32.c: fix the indentation
The indentation of this source is all over the place. Fix this.
This patch only changes whitespace.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: <stable@vger.kernel.org> # for v4.15 and up
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
-rw-r--r-- | drivers/media/v4l2-core/v4l2-compat-ioctl32.c | 212 |
1 files changed, 107 insertions, 105 deletions
diff --git a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c index 76ed43e774dd..83066b21b0b2 100644 --- a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c +++ b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c | |||
@@ -49,12 +49,12 @@ struct v4l2_window32 { | |||
49 | static int get_v4l2_window32(struct v4l2_window *kp, struct v4l2_window32 __user *up) | 49 | static int get_v4l2_window32(struct v4l2_window *kp, struct v4l2_window32 __user *up) |
50 | { | 50 | { |
51 | if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_window32)) || | 51 | if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_window32)) || |
52 | copy_from_user(&kp->w, &up->w, sizeof(up->w)) || | 52 | copy_from_user(&kp->w, &up->w, sizeof(up->w)) || |
53 | get_user(kp->field, &up->field) || | 53 | get_user(kp->field, &up->field) || |
54 | get_user(kp->chromakey, &up->chromakey) || | 54 | get_user(kp->chromakey, &up->chromakey) || |
55 | get_user(kp->clipcount, &up->clipcount) || | 55 | get_user(kp->clipcount, &up->clipcount) || |
56 | get_user(kp->global_alpha, &up->global_alpha)) | 56 | get_user(kp->global_alpha, &up->global_alpha)) |
57 | return -EFAULT; | 57 | return -EFAULT; |
58 | if (kp->clipcount > 2048) | 58 | if (kp->clipcount > 2048) |
59 | return -EINVAL; | 59 | return -EINVAL; |
60 | if (kp->clipcount) { | 60 | if (kp->clipcount) { |
@@ -84,11 +84,11 @@ static int get_v4l2_window32(struct v4l2_window *kp, struct v4l2_window32 __user | |||
84 | static int put_v4l2_window32(struct v4l2_window *kp, struct v4l2_window32 __user *up) | 84 | static int put_v4l2_window32(struct v4l2_window *kp, struct v4l2_window32 __user *up) |
85 | { | 85 | { |
86 | if (copy_to_user(&up->w, &kp->w, sizeof(kp->w)) || | 86 | if (copy_to_user(&up->w, &kp->w, sizeof(kp->w)) || |
87 | put_user(kp->field, &up->field) || | 87 | put_user(kp->field, &up->field) || |
88 | put_user(kp->chromakey, &up->chromakey) || | 88 | put_user(kp->chromakey, &up->chromakey) || |
89 | put_user(kp->clipcount, &up->clipcount) || | 89 | put_user(kp->clipcount, &up->clipcount) || |
90 | put_user(kp->global_alpha, &up->global_alpha)) | 90 | put_user(kp->global_alpha, &up->global_alpha)) |
91 | return -EFAULT; | 91 | return -EFAULT; |
92 | return 0; | 92 | return 0; |
93 | } | 93 | } |
94 | 94 | ||
@@ -100,7 +100,7 @@ static inline int get_v4l2_pix_format(struct v4l2_pix_format *kp, struct v4l2_pi | |||
100 | } | 100 | } |
101 | 101 | ||
102 | static inline int get_v4l2_pix_format_mplane(struct v4l2_pix_format_mplane *kp, | 102 | static inline int get_v4l2_pix_format_mplane(struct v4l2_pix_format_mplane *kp, |
103 | struct v4l2_pix_format_mplane __user *up) | 103 | struct v4l2_pix_format_mplane __user *up) |
104 | { | 104 | { |
105 | if (copy_from_user(kp, up, sizeof(struct v4l2_pix_format_mplane))) | 105 | if (copy_from_user(kp, up, sizeof(struct v4l2_pix_format_mplane))) |
106 | return -EFAULT; | 106 | return -EFAULT; |
@@ -115,7 +115,7 @@ static inline int put_v4l2_pix_format(struct v4l2_pix_format *kp, struct v4l2_pi | |||
115 | } | 115 | } |
116 | 116 | ||
117 | static inline int put_v4l2_pix_format_mplane(struct v4l2_pix_format_mplane *kp, | 117 | static inline int put_v4l2_pix_format_mplane(struct v4l2_pix_format_mplane *kp, |
118 | struct v4l2_pix_format_mplane __user *up) | 118 | struct v4l2_pix_format_mplane __user *up) |
119 | { | 119 | { |
120 | if (copy_to_user(up, kp, sizeof(struct v4l2_pix_format_mplane))) | 120 | if (copy_to_user(up, kp, sizeof(struct v4l2_pix_format_mplane))) |
121 | return -EFAULT; | 121 | return -EFAULT; |
@@ -238,7 +238,7 @@ static int __get_v4l2_format32(struct v4l2_format *kp, struct v4l2_format32 __us | |||
238 | return get_v4l2_meta_format(&kp->fmt.meta, &up->fmt.meta); | 238 | return get_v4l2_meta_format(&kp->fmt.meta, &up->fmt.meta); |
239 | default: | 239 | default: |
240 | pr_info("compat_ioctl32: unexpected VIDIOC_FMT type %d\n", | 240 | pr_info("compat_ioctl32: unexpected VIDIOC_FMT type %d\n", |
241 | kp->type); | 241 | kp->type); |
242 | return -EINVAL; | 242 | return -EINVAL; |
243 | } | 243 | } |
244 | } | 244 | } |
@@ -287,7 +287,7 @@ static int __put_v4l2_format32(struct v4l2_format *kp, struct v4l2_format32 __us | |||
287 | return put_v4l2_meta_format(&kp->fmt.meta, &up->fmt.meta); | 287 | return put_v4l2_meta_format(&kp->fmt.meta, &up->fmt.meta); |
288 | default: | 288 | default: |
289 | pr_info("compat_ioctl32: unexpected VIDIOC_FMT type %d\n", | 289 | pr_info("compat_ioctl32: unexpected VIDIOC_FMT type %d\n", |
290 | kp->type); | 290 | kp->type); |
291 | return -EINVAL; | 291 | return -EINVAL; |
292 | } | 292 | } |
293 | } | 293 | } |
@@ -321,7 +321,7 @@ static int get_v4l2_standard32(struct v4l2_standard *kp, struct v4l2_standard32 | |||
321 | { | 321 | { |
322 | /* other fields are not set by the user, nor used by the driver */ | 322 | /* other fields are not set by the user, nor used by the driver */ |
323 | if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_standard32)) || | 323 | if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_standard32)) || |
324 | get_user(kp->index, &up->index)) | 324 | get_user(kp->index, &up->index)) |
325 | return -EFAULT; | 325 | return -EFAULT; |
326 | return 0; | 326 | return 0; |
327 | } | 327 | } |
@@ -329,13 +329,14 @@ static int get_v4l2_standard32(struct v4l2_standard *kp, struct v4l2_standard32 | |||
329 | static int put_v4l2_standard32(struct v4l2_standard *kp, struct v4l2_standard32 __user *up) | 329 | static int put_v4l2_standard32(struct v4l2_standard *kp, struct v4l2_standard32 __user *up) |
330 | { | 330 | { |
331 | if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_standard32)) || | 331 | if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_standard32)) || |
332 | put_user(kp->index, &up->index) || | 332 | put_user(kp->index, &up->index) || |
333 | put_user(kp->id, &up->id) || | 333 | put_user(kp->id, &up->id) || |
334 | copy_to_user(up->name, kp->name, 24) || | 334 | copy_to_user(up->name, kp->name, 24) || |
335 | copy_to_user(&up->frameperiod, &kp->frameperiod, sizeof(kp->frameperiod)) || | 335 | copy_to_user(&up->frameperiod, &kp->frameperiod, |
336 | put_user(kp->framelines, &up->framelines) || | 336 | sizeof(kp->frameperiod)) || |
337 | copy_to_user(up->reserved, kp->reserved, 4 * sizeof(__u32))) | 337 | put_user(kp->framelines, &up->framelines) || |
338 | return -EFAULT; | 338 | copy_to_user(up->reserved, kp->reserved, 4 * sizeof(__u32))) |
339 | return -EFAULT; | ||
339 | return 0; | 340 | return 0; |
340 | } | 341 | } |
341 | 342 | ||
@@ -375,14 +376,14 @@ struct v4l2_buffer32 { | |||
375 | }; | 376 | }; |
376 | 377 | ||
377 | static int get_v4l2_plane32(struct v4l2_plane __user *up, struct v4l2_plane32 __user *up32, | 378 | static int get_v4l2_plane32(struct v4l2_plane __user *up, struct v4l2_plane32 __user *up32, |
378 | enum v4l2_memory memory) | 379 | enum v4l2_memory memory) |
379 | { | 380 | { |
380 | void __user *up_pln; | 381 | void __user *up_pln; |
381 | compat_long_t p; | 382 | compat_long_t p; |
382 | 383 | ||
383 | if (copy_in_user(up, up32, 2 * sizeof(__u32)) || | 384 | if (copy_in_user(up, up32, 2 * sizeof(__u32)) || |
384 | copy_in_user(&up->data_offset, &up32->data_offset, | 385 | copy_in_user(&up->data_offset, &up32->data_offset, |
385 | sizeof(__u32))) | 386 | sizeof(__u32))) |
386 | return -EFAULT; | 387 | return -EFAULT; |
387 | 388 | ||
388 | if (memory == V4L2_MEMORY_USERPTR) { | 389 | if (memory == V4L2_MEMORY_USERPTR) { |
@@ -396,7 +397,7 @@ static int get_v4l2_plane32(struct v4l2_plane __user *up, struct v4l2_plane32 __ | |||
396 | return -EFAULT; | 397 | return -EFAULT; |
397 | } else { | 398 | } else { |
398 | if (copy_in_user(&up->m.mem_offset, &up32->m.mem_offset, | 399 | if (copy_in_user(&up->m.mem_offset, &up32->m.mem_offset, |
399 | sizeof(__u32))) | 400 | sizeof(__u32))) |
400 | return -EFAULT; | 401 | return -EFAULT; |
401 | } | 402 | } |
402 | 403 | ||
@@ -404,23 +405,23 @@ static int get_v4l2_plane32(struct v4l2_plane __user *up, struct v4l2_plane32 __ | |||
404 | } | 405 | } |
405 | 406 | ||
406 | static int put_v4l2_plane32(struct v4l2_plane __user *up, struct v4l2_plane32 __user *up32, | 407 | static int put_v4l2_plane32(struct v4l2_plane __user *up, struct v4l2_plane32 __user *up32, |
407 | enum v4l2_memory memory) | 408 | enum v4l2_memory memory) |
408 | { | 409 | { |
409 | if (copy_in_user(up32, up, 2 * sizeof(__u32)) || | 410 | if (copy_in_user(up32, up, 2 * sizeof(__u32)) || |
410 | copy_in_user(&up32->data_offset, &up->data_offset, | 411 | copy_in_user(&up32->data_offset, &up->data_offset, |
411 | sizeof(__u32))) | 412 | sizeof(__u32))) |
412 | return -EFAULT; | 413 | return -EFAULT; |
413 | 414 | ||
414 | /* For MMAP, driver might've set up the offset, so copy it back. | 415 | /* For MMAP, driver might've set up the offset, so copy it back. |
415 | * USERPTR stays the same (was userspace-provided), so no copying. */ | 416 | * USERPTR stays the same (was userspace-provided), so no copying. */ |
416 | if (memory == V4L2_MEMORY_MMAP) | 417 | if (memory == V4L2_MEMORY_MMAP) |
417 | if (copy_in_user(&up32->m.mem_offset, &up->m.mem_offset, | 418 | if (copy_in_user(&up32->m.mem_offset, &up->m.mem_offset, |
418 | sizeof(__u32))) | 419 | sizeof(__u32))) |
419 | return -EFAULT; | 420 | return -EFAULT; |
420 | /* For DMABUF, driver might've set up the fd, so copy it back. */ | 421 | /* For DMABUF, driver might've set up the fd, so copy it back. */ |
421 | if (memory == V4L2_MEMORY_DMABUF) | 422 | if (memory == V4L2_MEMORY_DMABUF) |
422 | if (copy_in_user(&up32->m.fd, &up->m.fd, | 423 | if (copy_in_user(&up32->m.fd, &up->m.fd, |
423 | sizeof(int))) | 424 | sizeof(int))) |
424 | return -EFAULT; | 425 | return -EFAULT; |
425 | 426 | ||
426 | return 0; | 427 | return 0; |
@@ -434,19 +435,19 @@ static int get_v4l2_buffer32(struct v4l2_buffer *kp, struct v4l2_buffer32 __user | |||
434 | int ret; | 435 | int ret; |
435 | 436 | ||
436 | if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_buffer32)) || | 437 | if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_buffer32)) || |
437 | get_user(kp->index, &up->index) || | 438 | get_user(kp->index, &up->index) || |
438 | get_user(kp->type, &up->type) || | 439 | get_user(kp->type, &up->type) || |
439 | get_user(kp->flags, &up->flags) || | 440 | get_user(kp->flags, &up->flags) || |
440 | get_user(kp->memory, &up->memory) || | 441 | get_user(kp->memory, &up->memory) || |
441 | get_user(kp->length, &up->length)) | 442 | get_user(kp->length, &up->length)) |
442 | return -EFAULT; | 443 | return -EFAULT; |
443 | 444 | ||
444 | if (V4L2_TYPE_IS_OUTPUT(kp->type)) | 445 | if (V4L2_TYPE_IS_OUTPUT(kp->type)) |
445 | if (get_user(kp->bytesused, &up->bytesused) || | 446 | if (get_user(kp->bytesused, &up->bytesused) || |
446 | get_user(kp->field, &up->field) || | 447 | get_user(kp->field, &up->field) || |
447 | get_user(kp->timestamp.tv_sec, &up->timestamp.tv_sec) || | 448 | get_user(kp->timestamp.tv_sec, &up->timestamp.tv_sec) || |
448 | get_user(kp->timestamp.tv_usec, | 449 | get_user(kp->timestamp.tv_usec, |
449 | &up->timestamp.tv_usec)) | 450 | &up->timestamp.tv_usec)) |
450 | return -EFAULT; | 451 | return -EFAULT; |
451 | 452 | ||
452 | if (V4L2_TYPE_IS_MULTIPLANAR(kp->type)) { | 453 | if (V4L2_TYPE_IS_MULTIPLANAR(kp->type)) { |
@@ -466,7 +467,7 @@ static int get_v4l2_buffer32(struct v4l2_buffer *kp, struct v4l2_buffer32 __user | |||
466 | 467 | ||
467 | uplane32 = compat_ptr(p); | 468 | uplane32 = compat_ptr(p); |
468 | if (!access_ok(VERIFY_READ, uplane32, | 469 | if (!access_ok(VERIFY_READ, uplane32, |
469 | kp->length * sizeof(struct v4l2_plane32))) | 470 | kp->length * sizeof(struct v4l2_plane32))) |
470 | return -EFAULT; | 471 | return -EFAULT; |
471 | 472 | ||
472 | /* We don't really care if userspace decides to kill itself | 473 | /* We don't really care if userspace decides to kill itself |
@@ -490,12 +491,12 @@ static int get_v4l2_buffer32(struct v4l2_buffer *kp, struct v4l2_buffer32 __user | |||
490 | break; | 491 | break; |
491 | case V4L2_MEMORY_USERPTR: | 492 | case V4L2_MEMORY_USERPTR: |
492 | { | 493 | { |
493 | compat_long_t tmp; | 494 | compat_long_t tmp; |
494 | 495 | ||
495 | if (get_user(tmp, &up->m.userptr)) | 496 | if (get_user(tmp, &up->m.userptr)) |
496 | return -EFAULT; | 497 | return -EFAULT; |
497 | 498 | ||
498 | kp->m.userptr = (unsigned long)compat_ptr(tmp); | 499 | kp->m.userptr = (unsigned long)compat_ptr(tmp); |
499 | } | 500 | } |
500 | break; | 501 | break; |
501 | case V4L2_MEMORY_OVERLAY: | 502 | case V4L2_MEMORY_OVERLAY: |
@@ -521,22 +522,23 @@ static int put_v4l2_buffer32(struct v4l2_buffer *kp, struct v4l2_buffer32 __user | |||
521 | int ret; | 522 | int ret; |
522 | 523 | ||
523 | if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_buffer32)) || | 524 | if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_buffer32)) || |
524 | put_user(kp->index, &up->index) || | 525 | put_user(kp->index, &up->index) || |
525 | put_user(kp->type, &up->type) || | 526 | put_user(kp->type, &up->type) || |
526 | put_user(kp->flags, &up->flags) || | 527 | put_user(kp->flags, &up->flags) || |
527 | put_user(kp->memory, &up->memory)) | 528 | put_user(kp->memory, &up->memory)) |
528 | return -EFAULT; | 529 | return -EFAULT; |
529 | 530 | ||
530 | if (put_user(kp->bytesused, &up->bytesused) || | 531 | if (put_user(kp->bytesused, &up->bytesused) || |
531 | put_user(kp->field, &up->field) || | 532 | put_user(kp->field, &up->field) || |
532 | put_user(kp->timestamp.tv_sec, &up->timestamp.tv_sec) || | 533 | put_user(kp->timestamp.tv_sec, &up->timestamp.tv_sec) || |
533 | put_user(kp->timestamp.tv_usec, &up->timestamp.tv_usec) || | 534 | put_user(kp->timestamp.tv_usec, &up->timestamp.tv_usec) || |
534 | copy_to_user(&up->timecode, &kp->timecode, sizeof(struct v4l2_timecode)) || | 535 | copy_to_user(&up->timecode, &kp->timecode, |
535 | put_user(kp->sequence, &up->sequence) || | 536 | sizeof(struct v4l2_timecode)) || |
536 | put_user(kp->reserved2, &up->reserved2) || | 537 | put_user(kp->sequence, &up->sequence) || |
537 | put_user(kp->reserved, &up->reserved) || | 538 | put_user(kp->reserved2, &up->reserved2) || |
538 | put_user(kp->length, &up->length)) | 539 | put_user(kp->reserved, &up->reserved) || |
539 | return -EFAULT; | 540 | put_user(kp->length, &up->length)) |
541 | return -EFAULT; | ||
540 | 542 | ||
541 | if (V4L2_TYPE_IS_MULTIPLANAR(kp->type)) { | 543 | if (V4L2_TYPE_IS_MULTIPLANAR(kp->type)) { |
542 | num_planes = kp->length; | 544 | num_planes = kp->length; |
@@ -600,11 +602,11 @@ static int get_v4l2_framebuffer32(struct v4l2_framebuffer *kp, struct v4l2_frame | |||
600 | u32 tmp; | 602 | u32 tmp; |
601 | 603 | ||
602 | if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_framebuffer32)) || | 604 | if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_framebuffer32)) || |
603 | get_user(tmp, &up->base) || | 605 | get_user(tmp, &up->base) || |
604 | get_user(kp->capability, &up->capability) || | 606 | get_user(kp->capability, &up->capability) || |
605 | get_user(kp->flags, &up->flags) || | 607 | get_user(kp->flags, &up->flags) || |
606 | copy_from_user(&kp->fmt, &up->fmt, sizeof(up->fmt))) | 608 | copy_from_user(&kp->fmt, &up->fmt, sizeof(up->fmt))) |
607 | return -EFAULT; | 609 | return -EFAULT; |
608 | kp->base = (__force void *)compat_ptr(tmp); | 610 | kp->base = (__force void *)compat_ptr(tmp); |
609 | return 0; | 611 | return 0; |
610 | } | 612 | } |
@@ -614,11 +616,11 @@ static int put_v4l2_framebuffer32(struct v4l2_framebuffer *kp, struct v4l2_frame | |||
614 | u32 tmp = (u32)((unsigned long)kp->base); | 616 | u32 tmp = (u32)((unsigned long)kp->base); |
615 | 617 | ||
616 | if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_framebuffer32)) || | 618 | if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_framebuffer32)) || |
617 | put_user(tmp, &up->base) || | 619 | put_user(tmp, &up->base) || |
618 | put_user(kp->capability, &up->capability) || | 620 | put_user(kp->capability, &up->capability) || |
619 | put_user(kp->flags, &up->flags) || | 621 | put_user(kp->flags, &up->flags) || |
620 | copy_to_user(&up->fmt, &kp->fmt, sizeof(up->fmt))) | 622 | copy_to_user(&up->fmt, &kp->fmt, sizeof(up->fmt))) |
621 | return -EFAULT; | 623 | return -EFAULT; |
622 | return 0; | 624 | return 0; |
623 | } | 625 | } |
624 | 626 | ||
@@ -694,12 +696,12 @@ static int get_v4l2_ext_controls32(struct v4l2_ext_controls *kp, struct v4l2_ext | |||
694 | compat_caddr_t p; | 696 | compat_caddr_t p; |
695 | 697 | ||
696 | if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_ext_controls32)) || | 698 | if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_ext_controls32)) || |
697 | get_user(kp->which, &up->which) || | 699 | get_user(kp->which, &up->which) || |
698 | get_user(kp->count, &up->count) || | 700 | get_user(kp->count, &up->count) || |
699 | get_user(kp->error_idx, &up->error_idx) || | 701 | get_user(kp->error_idx, &up->error_idx) || |
700 | copy_from_user(kp->reserved, up->reserved, | 702 | copy_from_user(kp->reserved, up->reserved, |
701 | sizeof(kp->reserved))) | 703 | sizeof(kp->reserved))) |
702 | return -EFAULT; | 704 | return -EFAULT; |
703 | if (kp->count == 0) { | 705 | if (kp->count == 0) { |
704 | kp->controls = NULL; | 706 | kp->controls = NULL; |
705 | return 0; | 707 | return 0; |
@@ -710,7 +712,7 @@ static int get_v4l2_ext_controls32(struct v4l2_ext_controls *kp, struct v4l2_ext | |||
710 | return -EFAULT; | 712 | return -EFAULT; |
711 | ucontrols = compat_ptr(p); | 713 | ucontrols = compat_ptr(p); |
712 | if (!access_ok(VERIFY_READ, ucontrols, | 714 | if (!access_ok(VERIFY_READ, ucontrols, |
713 | kp->count * sizeof(struct v4l2_ext_control32))) | 715 | kp->count * sizeof(struct v4l2_ext_control32))) |
714 | return -EFAULT; | 716 | return -EFAULT; |
715 | kcontrols = compat_alloc_user_space(kp->count * | 717 | kcontrols = compat_alloc_user_space(kp->count * |
716 | sizeof(struct v4l2_ext_control)); | 718 | sizeof(struct v4l2_ext_control)); |
@@ -746,11 +748,11 @@ static int put_v4l2_ext_controls32(struct v4l2_ext_controls *kp, struct v4l2_ext | |||
746 | compat_caddr_t p; | 748 | compat_caddr_t p; |
747 | 749 | ||
748 | if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_ext_controls32)) || | 750 | if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_ext_controls32)) || |
749 | put_user(kp->which, &up->which) || | 751 | put_user(kp->which, &up->which) || |
750 | put_user(kp->count, &up->count) || | 752 | put_user(kp->count, &up->count) || |
751 | put_user(kp->error_idx, &up->error_idx) || | 753 | put_user(kp->error_idx, &up->error_idx) || |
752 | copy_to_user(up->reserved, kp->reserved, sizeof(up->reserved))) | 754 | copy_to_user(up->reserved, kp->reserved, sizeof(up->reserved))) |
753 | return -EFAULT; | 755 | return -EFAULT; |
754 | if (!kp->count) | 756 | if (!kp->count) |
755 | return 0; | 757 | return 0; |
756 | 758 | ||
@@ -758,7 +760,7 @@ static int put_v4l2_ext_controls32(struct v4l2_ext_controls *kp, struct v4l2_ext | |||
758 | return -EFAULT; | 760 | return -EFAULT; |
759 | ucontrols = compat_ptr(p); | 761 | ucontrols = compat_ptr(p); |
760 | if (!access_ok(VERIFY_WRITE, ucontrols, | 762 | if (!access_ok(VERIFY_WRITE, ucontrols, |
761 | n * sizeof(struct v4l2_ext_control32))) | 763 | n * sizeof(struct v4l2_ext_control32))) |
762 | return -EFAULT; | 764 | return -EFAULT; |
763 | 765 | ||
764 | while (--n >= 0) { | 766 | while (--n >= 0) { |
@@ -796,15 +798,15 @@ struct v4l2_event32 { | |||
796 | static int put_v4l2_event32(struct v4l2_event *kp, struct v4l2_event32 __user *up) | 798 | static int put_v4l2_event32(struct v4l2_event *kp, struct v4l2_event32 __user *up) |
797 | { | 799 | { |
798 | if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_event32)) || | 800 | if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_event32)) || |
799 | put_user(kp->type, &up->type) || | 801 | put_user(kp->type, &up->type) || |
800 | copy_to_user(&up->u, &kp->u, sizeof(kp->u)) || | 802 | copy_to_user(&up->u, &kp->u, sizeof(kp->u)) || |
801 | put_user(kp->pending, &up->pending) || | 803 | put_user(kp->pending, &up->pending) || |
802 | put_user(kp->sequence, &up->sequence) || | 804 | put_user(kp->sequence, &up->sequence) || |
803 | put_user(kp->timestamp.tv_sec, &up->timestamp.tv_sec) || | 805 | put_user(kp->timestamp.tv_sec, &up->timestamp.tv_sec) || |
804 | put_user(kp->timestamp.tv_nsec, &up->timestamp.tv_nsec) || | 806 | put_user(kp->timestamp.tv_nsec, &up->timestamp.tv_nsec) || |
805 | put_user(kp->id, &up->id) || | 807 | put_user(kp->id, &up->id) || |
806 | copy_to_user(up->reserved, kp->reserved, 8 * sizeof(__u32))) | 808 | copy_to_user(up->reserved, kp->reserved, 8 * sizeof(__u32))) |
807 | return -EFAULT; | 809 | return -EFAULT; |
808 | return 0; | 810 | return 0; |
809 | } | 811 | } |
810 | 812 | ||
@@ -821,12 +823,12 @@ static int get_v4l2_edid32(struct v4l2_edid *kp, struct v4l2_edid32 __user *up) | |||
821 | u32 tmp; | 823 | u32 tmp; |
822 | 824 | ||
823 | if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_edid32)) || | 825 | if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_edid32)) || |
824 | get_user(kp->pad, &up->pad) || | 826 | get_user(kp->pad, &up->pad) || |
825 | get_user(kp->start_block, &up->start_block) || | 827 | get_user(kp->start_block, &up->start_block) || |
826 | get_user(kp->blocks, &up->blocks) || | 828 | get_user(kp->blocks, &up->blocks) || |
827 | get_user(tmp, &up->edid) || | 829 | get_user(tmp, &up->edid) || |
828 | copy_from_user(kp->reserved, up->reserved, sizeof(kp->reserved))) | 830 | copy_from_user(kp->reserved, up->reserved, sizeof(kp->reserved))) |
829 | return -EFAULT; | 831 | return -EFAULT; |
830 | kp->edid = (__force u8 *)compat_ptr(tmp); | 832 | kp->edid = (__force u8 *)compat_ptr(tmp); |
831 | return 0; | 833 | return 0; |
832 | } | 834 | } |
@@ -836,12 +838,12 @@ static int put_v4l2_edid32(struct v4l2_edid *kp, struct v4l2_edid32 __user *up) | |||
836 | u32 tmp = (u32)((unsigned long)kp->edid); | 838 | u32 tmp = (u32)((unsigned long)kp->edid); |
837 | 839 | ||
838 | if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_edid32)) || | 840 | if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_edid32)) || |
839 | put_user(kp->pad, &up->pad) || | 841 | put_user(kp->pad, &up->pad) || |
840 | put_user(kp->start_block, &up->start_block) || | 842 | put_user(kp->start_block, &up->start_block) || |
841 | put_user(kp->blocks, &up->blocks) || | 843 | put_user(kp->blocks, &up->blocks) || |
842 | put_user(tmp, &up->edid) || | 844 | put_user(tmp, &up->edid) || |
843 | copy_to_user(up->reserved, kp->reserved, sizeof(up->reserved))) | 845 | copy_to_user(up->reserved, kp->reserved, sizeof(up->reserved))) |
844 | return -EFAULT; | 846 | return -EFAULT; |
845 | return 0; | 847 | return 0; |
846 | } | 848 | } |
847 | 849 | ||