diff options
Diffstat (limited to 'drivers/media/video/omap/omap_vout.c')
-rw-r--r-- | drivers/media/video/omap/omap_vout.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/drivers/media/video/omap/omap_vout.c b/drivers/media/video/omap/omap_vout.c index 4ada9be1d430..4d07c5844402 100644 --- a/drivers/media/video/omap/omap_vout.c +++ b/drivers/media/video/omap/omap_vout.c | |||
@@ -982,6 +982,14 @@ static int omap_vout_buffer_setup(struct videobuf_queue *q, unsigned int *count, | |||
982 | startindex = (vout->vid == OMAP_VIDEO1) ? | 982 | startindex = (vout->vid == OMAP_VIDEO1) ? |
983 | video1_numbuffers : video2_numbuffers; | 983 | video1_numbuffers : video2_numbuffers; |
984 | 984 | ||
985 | /* Check the size of the buffer */ | ||
986 | if (*size > vout->buffer_size) { | ||
987 | v4l2_err(&vout->vid_dev->v4l2_dev, | ||
988 | "buffer allocation mismatch [%u] [%u]\n", | ||
989 | *size, vout->buffer_size); | ||
990 | return -ENOMEM; | ||
991 | } | ||
992 | |||
985 | for (i = startindex; i < *count; i++) { | 993 | for (i = startindex; i < *count; i++) { |
986 | vout->buffer_size = *size; | 994 | vout->buffer_size = *size; |
987 | 995 | ||
@@ -1228,6 +1236,14 @@ static int omap_vout_mmap(struct file *file, struct vm_area_struct *vma) | |||
1228 | (vma->vm_pgoff << PAGE_SHIFT)); | 1236 | (vma->vm_pgoff << PAGE_SHIFT)); |
1229 | return -EINVAL; | 1237 | return -EINVAL; |
1230 | } | 1238 | } |
1239 | /* Check the size of the buffer */ | ||
1240 | if (size > vout->buffer_size) { | ||
1241 | v4l2_err(&vout->vid_dev->v4l2_dev, | ||
1242 | "insufficient memory [%lu] [%u]\n", | ||
1243 | size, vout->buffer_size); | ||
1244 | return -ENOMEM; | ||
1245 | } | ||
1246 | |||
1231 | q->bufs[i]->baddr = vma->vm_start; | 1247 | q->bufs[i]->baddr = vma->vm_start; |
1232 | 1248 | ||
1233 | vma->vm_flags |= VM_RESERVED; | 1249 | vma->vm_flags |= VM_RESERVED; |
@@ -2391,7 +2407,7 @@ static int __init omap_vout_create_video_devices(struct platform_device *pdev) | |||
2391 | /* Register the Video device with V4L2 | 2407 | /* Register the Video device with V4L2 |
2392 | */ | 2408 | */ |
2393 | vfd = vout->vfd; | 2409 | vfd = vout->vfd; |
2394 | if (video_register_device(vfd, VFL_TYPE_GRABBER, k + 1) < 0) { | 2410 | if (video_register_device(vfd, VFL_TYPE_GRABBER, -1) < 0) { |
2395 | dev_err(&pdev->dev, ": Could not register " | 2411 | dev_err(&pdev->dev, ": Could not register " |
2396 | "Video for Linux device\n"); | 2412 | "Video for Linux device\n"); |
2397 | vfd->minor = -1; | 2413 | vfd->minor = -1; |