From patchwork Mon May 27 06:00:43 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Seung-Woo Kim X-Patchwork-Id: 2617701 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork1.kernel.org (Postfix) with ESMTP id AB1AD3FD4E for ; Mon, 27 May 2013 06:00:50 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B4798E60A6 for ; Sun, 26 May 2013 23:00:50 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mailout2.samsung.com (mailout2.samsung.com [203.254.224.25]) by gabe.freedesktop.org (Postfix) with ESMTP id 8F465E6014 for ; Sun, 26 May 2013 23:00:38 -0700 (PDT) Received: from epcpsbgr4.samsung.com (u144.gpu120.samsung.co.kr [203.254.230.144]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MNG00MXH0OBX100@mailout2.samsung.com> for dri-devel@lists.freedesktop.org; Mon, 27 May 2013 15:00:36 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [172.20.52.112]) by epcpsbgr4.samsung.com (EPCPMTA) with SMTP id 0A.85.29708.386F2A15; Mon, 27 May 2013 15:00:35 +0900 (KST) X-AuditID: cbfee690-b7f6f6d00000740c-a0-51a2f68346c1 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 10.54.28381.386F2A15; Mon, 27 May 2013 15:00:35 +0900 (KST) Received: from localhost.localdomain ([10.90.8.56]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MNG000F40OXPH70@mmp2.samsung.com>; Mon, 27 May 2013 15:00:35 +0900 (KST) From: Seung-Woo Kim To: dri-devel@lists.freedesktop.org, inki.dae@samsung.com Subject: [PATCH] drm/exynos: fix checks for valid mixer window Date: Mon, 27 May 2013 15:00:43 +0900 Message-id: <1369634443-16157-1-git-send-email-sw0312.kim@samsung.com> X-Mailer: git-send-email 1.7.4.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrELMWRmVeSWpSXmKPExsWyRsSkQLf526JAg41XpC16z51ksrjy9T2b xecPLewWk+5PYLF4/cLQ4mzTG3aLGZNfsjmwe2z/9oDV4373cSaPvi2rGAOYo7hsUlJzMstS i/TtErgy9m85x15wh69iafcktgbGuTxdjBwcEgImEm+apLoYOYFMMYkL99azdTFycQgJLGWU WNW6mBUiYSIx490TFojEdEaJFcsvM0I4zUwSn+//ZASpYhPQkdi/5DdYh4iApcSDrb+ZQWxm gWqJgzf3gdUIC9hJXJ61GSjOzsEioCpxMRkkyivgJvGlfRYTxC4FiQX33oIdISHwmU3idNM3 sASLgIDEt8mHWCCOlpXYdIAZol5S4uCKGywTGAUXMDKsYhRNLUguKE5KLzLRK07MLS7NS9dL zs/dxAgMz9P/nk3YwXjvgPUhxmSgcROZpUST84HhnVcSb2hsZmRhamJqbGRuaUaasJI4r3qL daCQQHpiSWp2ampBalF8UWlOavEhRiYOTqkGxqAT3V+1xZ/s/X3329RCycS7JjwbDAsq7YJ4 z39+IH7kS63BZ48dOTn/pJZNWa2xb/XfZCsOGwNzEbOj65v+nYvsOR4mM0/Y/sFxo0jHT+oy 94uZ5VbXHG32X2+cyviisydtQ9Krwmd2nKsvGVxVjLi5WIfbLGfSlXm33X+p2Dtau53u2dSi r8RSnJFoqMVcVJwIAHntSXNlAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrAIsWRmVeSWpSXmKPExsVy+t9jQd3mb4sCDZ7sFbLoPXeSyeLK1/ds Fp8/tLBbTLo/gcXi9QtDi7NNb9gtZkx+yebA7rH92wNWj/vdx5k8+rasYgxgjmpgtMlITUxJ LVJIzUvOT8nMS7dV8g6Od443NTMw1DW0tDBXUshLzE21VXLxCdB1y8wB2q6kUJaYUwoUCkgs LlbSt8M0ITTETdcCpjFC1zckCK7HyAANJKxhzNi/5Rx7wR2+iqXdk9gaGOfydDFyckgImEjM ePeEBcIWk7hwbz1bFyMXh5DAdEaJFcsvM0I4zUwSn+//ZASpYhPQkdi/5DcriC0iYCnxYOtv ZhCbWaBa4uDNfWA1wgJ2EpdnbQaKs3OwCKhKXEwGifIKuEl8aZ/FBLFLQWLBvbdsExi5FzAy rGIUTS1ILihOSs811CtOzC0uzUvXS87P3cQIDv9nUjsYVzZYHGIU4GBU4uH9MWtRoBBrYllx Ze4hRgkOZiUR3oRooBBvSmJlVWpRfnxRaU5q8SHGZKDdE5mlRJPzgbGZVxJvaGxiZmRpZG5o YWRsTpqwkjjvgVbrQCGB9MSS1OzU1ILUIpgtTBycUg2Mkh76U+fe/DH1rV/EFoGEJx9c5pd4 P8nxnuAzN8/x8J8b36bt5nRq9cz0v68awKFieCl9f6k4v60RM38628dHpt+V7gd9+e/Pd36Z z5uv4tK9vm5SKyK9XUxMLj/cPeFfAmPZ56Dfsx7e+ubUzGD3M28bi9GdJRulGsvez1l3KHOq 12ffJl13JZbijERDLeai4kQARgZcbsMCAAA= DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Cc: kyungmin.park@samsung.com, hyunhee.kim@samsung.com, sw0312.kim@samsung.com, k.kozlowski@samsung.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org From: Krzysztof Kozlowski Valid values for mixer window are from 0 to MIXER_WIN_NR-1 inclusive. Arrays in structures (e.g. mixer_context.win_data) have size of MIXER_WIN_NR so checks for wrong mixer window must be greater-equal. Signed-off-by: Krzysztof Kozlowski Signed-off-by: Hyunhee Kim Signed-off-by: Seung-Woo Kim --- drivers/gpu/drm/exynos/exynos_drm_hdmi.c | 4 ++-- drivers/gpu/drm/exynos/exynos_mixer.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c index 437fb94..b9b2726 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c @@ -344,7 +344,7 @@ static void drm_mixer_commit(struct device *subdrv_dev, int zpos) DRM_DEBUG_KMS("%s\n", __FILE__); - if (win < 0 || win > MIXER_WIN_NR) { + if (win < 0 || win >= MIXER_WIN_NR) { DRM_ERROR("mixer window[%d] is wrong\n", win); return; } @@ -362,7 +362,7 @@ static void drm_mixer_disable(struct device *subdrv_dev, int zpos) DRM_DEBUG_KMS("%s\n", __FILE__); - if (win < 0 || win > MIXER_WIN_NR) { + if (win < 0 || win >= MIXER_WIN_NR) { DRM_ERROR("mixer window[%d] is wrong\n", win); return; } diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index 7c197d38..3658e07 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c @@ -742,7 +742,7 @@ static void mixer_win_mode_set(void *ctx, if (win == DEFAULT_ZPOS) win = MIXER_DEFAULT_WIN; - if (win < 0 || win > MIXER_WIN_NR) { + if (win < 0 || win >= MIXER_WIN_NR) { DRM_ERROR("mixer window[%d] is wrong\n", win); return; }