]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
ENGR00280663-2 IPUv3 device: check downsize ratio overflow
authorLiu Ying <Ying.Liu@freescale.com>
Sun, 22 Sep 2013 04:37:39 +0000 (12:37 +0800)
committerLothar Waßmann <LW@KARO-electronics.de>
Wed, 20 Aug 2014 08:06:32 +0000 (10:06 +0200)
IPUv3 IC task downsize scaling ratio cannot exceed or be
equal to 8:1. This patch makes the code return error code
if the ratio overflows.

Signed-off-by: Liu Ying <Ying.Liu@freescale.com>
drivers/mxc/ipu3/ipu_device.c
include/uapi/linux/ipu.h

index 5814adb55837d34b163da7d3addfa174a23c1bde..6781582a47c7c2cd873bd5c70bdf0d29d7f20b9d 100644 (file)
@@ -665,6 +665,12 @@ static void dump_check_err(struct device *dev, int err)
        case IPU_CHECK_ERR_SPLIT_WITH_ROT:
                dev_err(dev, "not support split mode with rotation\n");
                break;
+       case IPU_CHECK_ERR_W_DOWNSIZE_OVER:
+               dev_err(dev, "horizontal downsizing ratio overflow\n");
+               break;
+       case IPU_CHECK_ERR_H_DOWNSIZE_OVER:
+               dev_err(dev, "vertical downsizing ratio overflow\n");
+               break;
        default:
                break;
        }
@@ -966,6 +972,16 @@ static int check_task(struct ipu_task_entry *t)
                                &t->set.o_off, &t->set.o_uoff,
                                &t->set.o_voff, &t->set.ostride);
 
+       if (t->output.crop.w * 8 <= t->input.crop.w) {
+               ret = IPU_CHECK_ERR_W_DOWNSIZE_OVER;
+               goto done;
+       }
+
+       if (t->output.crop.h * 8 <= t->input.crop.h) {
+               ret = IPU_CHECK_ERR_H_DOWNSIZE_OVER;
+               goto done;
+       }
+
        if ((IPU_PIX_FMT_TILED_NV12 == t->input.format) ||
                (IPU_PIX_FMT_TILED_NV12F == t->input.format)) {
                if ((t->input.crop.w > soc_max_in_width(1)) ||
index 866d2b639d21e1f68cbe7ab7097a1cdf1f45fe77..b2083288a057873eb4081d0fb20bede30a7ee168 100644 (file)
@@ -269,6 +269,8 @@ enum {
        IPU_CHECK_ERR_SPLIT_WITH_ROT,
        IPU_CHECK_ERR_NOT_SUPPORT,
        IPU_CHECK_ERR_NOT16ALIGN,
+       IPU_CHECK_ERR_W_DOWNSIZE_OVER,
+       IPU_CHECK_ERR_H_DOWNSIZE_OVER,
 };
 
 /* IOCTL commands */