summaryrefslogtreecommitdiff
path: root/drivers/media
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/video/mxc/output/mxc_vout.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/media/video/mxc/output/mxc_vout.c b/drivers/media/video/mxc/output/mxc_vout.c
index 626bad59e151..727c07abaab9 100644
--- a/drivers/media/video/mxc/output/mxc_vout.c
+++ b/drivers/media/video/mxc/output/mxc_vout.c
@@ -1379,6 +1379,14 @@ static int mxc_vidioc_s_crop(struct file *file, void *fh,
/* stride line limitation */
crop->c.height -= crop->c.height % 8;
crop->c.width -= crop->c.width % 8;
+ if ((crop->c.width <= 0) || (crop->c.height <= 0) ||
+ ((crop->c.left + crop->c.width) > (b->left + b->width)) ||
+ ((crop->c.top + crop->c.height) > (b->top + b->height))) {
+ v4l2_err(vout->vfd->v4l2_dev, "s_crop err: %d, %d, %d, %d",
+ crop->c.left, crop->c.top,
+ crop->c.width, crop->c.height);
+ return -EINVAL;
+ }
/* the same setting, return */
if (vout->disp_support_windows) {