[COMMON] fimc-is2: add sanity checking for selected sub-device ch. mode
authorJeongtae Park <jtp.park@samsung.com>
Mon, 30 Apr 2018 01:16:34 +0000 (10:16 +0900)
committerSunyoung Kang <sy0816.kang@samsung.com>
Mon, 23 Jul 2018 08:05:08 +0000 (17:05 +0900)
Change-Id: I521143efe488005578e93e3b7f2b625ce3d79c43
Signed-off-by: Jeongtae Park <jtp.park@samsung.com>
drivers/media/platform/exynos/fimc-is2/fimc-is-device-csi_v4.c

index e11f22f824047fe7e4f0c7a34456d1c396f69cd9..9af480e88db2781c9cae5ddc557d9b9c28bf28db 100644 (file)
@@ -1748,6 +1748,12 @@ static int csi_s_format(struct v4l2_subdev *subdev,
        else
                csi->scm = SCM_W_PAF_HW;
 
+       if (csi->scm >= csi->num_of_scm) {
+               merr("invalid sub-device channel mode(%d/%d)", csi,
+                               csi->scm, csi->num_of_scm);
+               return -EINVAL;
+       }
+
        /*
         * DMA HW doesn't have own reset register.
         * So, all virtual ch dma should be disabled