From: Jeongtae Park Date: Mon, 30 Apr 2018 01:16:34 +0000 (+0900) Subject: [COMMON] fimc-is2: add sanity checking for selected sub-device ch. mode X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=a34928a678f96eb1f6aa1e69497bebf0c193169b;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git [COMMON] fimc-is2: add sanity checking for selected sub-device ch. mode Change-Id: I521143efe488005578e93e3b7f2b625ce3d79c43 Signed-off-by: Jeongtae Park --- diff --git a/drivers/media/platform/exynos/fimc-is2/fimc-is-device-csi_v4.c b/drivers/media/platform/exynos/fimc-is2/fimc-is-device-csi_v4.c index e11f22f82404..9af480e88db2 100644 --- a/drivers/media/platform/exynos/fimc-is2/fimc-is-device-csi_v4.c +++ b/drivers/media/platform/exynos/fimc-is2/fimc-is-device-csi_v4.c @@ -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