summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFancy Fang <chen.fang@freescale.com>2015-04-21 16:17:36 +0800
committerFrank Li <Frank.Li@freescale.com>2015-04-24 23:04:11 +0800
commit282dd24e8bcabc48a49f58c97bb424200ca2cce3 (patch)
tree1ac8f0ca45b0c5cf27d74e06ca39032b0ca06ff4
parent14aa32474b855625c3ee039f7319f46d23336ad9 (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)
-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 780e228a5c7f..9a4bd44b60bd 100644
--- a/drivers/media/platform/mxc/output/mxc_pxp_v4l2.c
+++ b/drivers/media/platform/mxc/output/mxc_pxp_v4l2.c
@@ -1034,10 +1034,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);
@@ -1045,6 +1041,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;