summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorFancy Fang <chen.fang@freescale.com>2015-04-21 16:17:36 +0800
committerguoyin.chen <guoyin.chen@freescale.com>2015-05-08 17:26:41 +0800
commit1be8f8dbd26470cc6fec6fb537b5cd78d20d626c (patch)
tree3075d2dc031abb31f244d9dd851e46f82cd4879b /drivers
parent53b65c5ce6ac484d2b0c5ec78ea6feffb90c3f8f (diff)
MLK-10696 media: pxp-v4l2: refine the bounds sanity check logic
The output image area bounds check should be moved to where the 'l', 't', 'w' and 'h' are finalized to avoid the drect area beyond the maximum fb display area which may cause overflow issue when calculating the PXP PS LRC or ULC. Signed-off-by: Fancy Fang <chen.fang@freescale.com> (cherry picked from commit cf63a1f27173b9eb94992926cb1a22895d6ced5e)
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/platform/mxc/output/mxc_pxp_v4l2.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/media/platform/mxc/output/mxc_pxp_v4l2.c b/drivers/media/platform/mxc/output/mxc_pxp_v4l2.c
index 50374077ff19..c14cbd1fef89 100644
--- a/drivers/media/platform/mxc/output/mxc_pxp_v4l2.c
+++ b/drivers/media/platform/mxc/output/mxc_pxp_v4l2.c
@@ -1045,10 +1045,6 @@ static int pxp_s_crop(struct file *file, void *fh,
w = max(w, PXP_MIN_PIX);
h = min(h, fbh);
h = max(h, PXP_MIN_PIX);
- if ((l + w) > fbw)
- l = 0;
- if ((t + h) > fbh)
- t = 0;
/* Round up values to PxP pixel block */
l = roundup(l, PXP_MIN_PIX);
@@ -1056,6 +1052,11 @@ static int pxp_s_crop(struct file *file, void *fh,
w = roundup(w, PXP_MIN_PIX);
h = roundup(h, PXP_MIN_PIX);
+ if ((l + w) > fbw)
+ l = 0;
+ if ((t + h) > fbh)
+ t = 0;
+
pxp->pxp_conf.proc_data.drect.left = l;
pxp->pxp_conf.proc_data.drect.top = t;
pxp->pxp_conf.proc_data.drect.width = w;