From: Hyungwon Hwang Date: Mon, 24 Aug 2015 10:33:27 +0000 (+0900) Subject: drm/exynos: gsc: normalize invalid buf idx from userspace X-Git-Tag: submit/tizen/20160405.082219~66 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=075e2a1a076f1260eb35bcfe5ac1de95341463ea;p=platform%2Fkernel%2Flinux-exynos.git drm/exynos: gsc: normalize invalid buf idx from userspace At least in the one frame processing mode which is the only mode supported by the current gsc driver, the buf idx is not meaningful for the driver. Because only one address in the buffer is valid at a time, so it is OK to convert the invalid buf idx from userspace to a valid idx, process the frame, and return the result with original buf idx. Change-Id: Ia56449498e90ae211d7ad0aaede5d48bdfec2d8b Signed-off-by: Hyungwon Hwang --- diff --git a/drivers/gpu/drm/exynos/exynos_drm_gsc.c b/drivers/gpu/drm/exynos/exynos_drm_gsc.c index 3e46706d1c76..471f45a2b5d5 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_gsc.c +++ b/drivers/gpu/drm/exynos/exynos_drm_gsc.c @@ -822,10 +822,7 @@ static int gsc_src_set_addr(struct device *dev, DRM_DEBUG_KMS("prop_id[%d]buf_id[%d]buf_type[%d]\n", property->prop_id, buf_id, buf_type); - if (buf_id > GSC_MAX_SRC) { - dev_info(ippdrv->dev, "inavlid buf_id %d.\n", buf_id); - return -EINVAL; - } + buf_id %= GSC_MAX_SRC; /* address register set */ switch (buf_type) { @@ -1287,10 +1284,7 @@ static int gsc_dst_set_addr(struct device *dev, DRM_DEBUG_KMS("prop_id[%d]buf_id[%d]buf_type[%d]\n", property->prop_id, buf_id, buf_type); - if (buf_id > GSC_MAX_DST) { - dev_info(ippdrv->dev, "inavlid buf_id %d.\n", buf_id); - return -EINVAL; - } + buf_id %= GSC_MAX_DST; /* address register set */ switch (buf_type) {