From patchwork Mon May 27 11:08:14 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Inki Dae X-Patchwork-Id: 2619131 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork2.kernel.org (Postfix) with ESMTP id B57C8DF215 for ; Mon, 27 May 2013 11:08:38 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AC119E60ED for ; Mon, 27 May 2013 04:08:38 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) by gabe.freedesktop.org (Postfix) with ESMTP id C7B9FE60EF for ; Mon, 27 May 2013 04:08:16 -0700 (PDT) Received: from epcpsbgr3.samsung.com (u143.gpu120.samsung.co.kr [203.254.230.143]) by mailout3.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MNG00AWIEXL27F0@mailout3.samsung.com> for dri-devel@lists.freedesktop.org; Mon, 27 May 2013 20:08:15 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [172.20.52.115]) by epcpsbgr3.samsung.com (EPCPMTA) with SMTP id A1.DE.03969.F9E33A15; Mon, 27 May 2013 20:08:15 +0900 (KST) X-AuditID: cbfee68f-b7f436d000000f81-f9-51a33e9f7a0d Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id E6.C8.21068.E9E33A15; Mon, 27 May 2013 20:08:15 +0900 (KST) Received: from daeinki-desktop.10.32.193.11 ([10.90.8.53]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MNG004OIEXQ8S30@mmp1.samsung.com>; Mon, 27 May 2013 20:08:14 +0900 (KST) From: Inki Dae To: airlied@linux.ie, dri-devel@lists.freedesktop.org Subject: [PATCH] drm/exynos: fix tests for valid FIMD window number Date: Mon, 27 May 2013 20:08:14 +0900 Message-id: <1369652894-13958-1-git-send-email-inki.dae@samsung.com> X-Mailer: git-send-email 1.7.5.4 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrCLMWRmVeSWpSXmKPExsWyRsSkWHe+3eJAg0etPBa9504yWVz5+p7N YtL9CSwWL+5dZLF4/cLQ4mzTG3aLGZNfsjmwe2z/9oDV4373cSaPvi2rGAOYo7hsUlJzMstS i/TtErgy9szcxlxwjKdi0Y45LA2M07i6GDk5JARMJBomnGSFsMUkLtxbz9bFyMUhJLCUUWJe 60xWmKJNF26zgNhCAosYJZb/z4co6mKSOP7tLFgRm4CqxMQV99lAbBEBU4mOSUvBGpgFpjJK 7P6rBmILCzhLHD8+lQnEZgGqv/PgLTOIzSvgInH2wBGoZQoSv46sYgVZICHwnU3i+NcPjBAN AhLfJh8CGsoBlJCV2HSAGaJeUuLgihssExgFFzAyrGIUTS1ILihOSi8y1itOzC0uzUvXS87P 3cQIDNHT/57172C8e8D6EGMy0LiJzFKiyfnAEM8riTc0NjOyMDUxNTYytzQjTVhJnFetxTpQ SCA9sSQ1OzW1ILUovqg0J7X4ECMTB6dUA+MS2+PTEmTNA5ay6XXHPDtTaNqckc7pfOj6IqeT 3kE1ldzLk275uxVOS5JpFZ5444TaHe8b/Uvbnv721Q+6c6/bQfLKlclGbgbM3Qal0Rvcjq7d lOUnbVp3QPp9JXPXNNEYR6Mb1Yrd8rI60RxlG3Nn6m27WdkppsBi7WzRIlSx26VTbr2bEktx RqKhFnNRcSIAS2y5FGcCAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrIIsWRmVeSWpSXmKPExsVy+t9jAd35dosDDZoPslj0njvJZHHl63s2 i0n3J7BYvLh3kcXi9QtDi7NNb9gtZkx+yebA7rH92wNWj/vdx5k8+rasYgxgjmpgtMlITUxJ LVJIzUvOT8nMS7dV8g6Od443NTMw1DW0tDBXUshLzE21VXLxCdB1y8wB2q6kUJaYUwoUCkgs LlbSt8M0ITTETdcCpjFC1zckCK7HyAANJKxhzNgzcxtzwTGeikU75rA0ME7j6mLk5JAQMJHY dOE2C4QtJnHh3no2EFtIYBGjxPL/+V2MXEB2F5PE8W9nWUESbAKqEhNX3AcrEhEwleiYtBSs mVlgKqPE7r9qILawgLPE8eNTmUBsFqD6Ow/eMoPYvAIuEmcPHGGFWKYg8evIKtYJjNwLGBlW MYqmFiQXFCel5xrpFSfmFpfmpesl5+duYgRHwDPpHYyrGiwOMQpwMCrx8C6YsShQiDWxrLgy 9xCjBAezkgivlNniQCHelMTKqtSi/Pii0pzU4kOMyUDbJzJLiSbnA6MzryTe0NjEzMjSyNzQ wsjYnDRhJXHeg63WgUIC6YklqdmpqQWpRTBbmDg4pRoYu66tO/+9u916k+xDvvySmD3zMuvm buZsafzlw8t0WWv1i+svI2a637k/Ob7609UlG3rS0pZcWN+5xdhNZ18aw6yKPZ9VL67o5TBq uxhzTXRalE6l37VZsy6tqJVJf3Toj/Dd3U5bXkw8/WDTx7wm1edbV7DquzyrZk8NefFqt6D6 5klMwv7b5yqxFGckGmoxFxUnAgBUfzmlxAIAAA== DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Cc: kyungmin.park@samsung.com, sw0312.kim@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 FIMD windows are from 0 to WINDOWS_NR-1 inclusive (5 windows in total). The WINDOWS_NR is also a size of fimd_context.win_data array. However, early-return tests for wrong values of windows accepted a value of WINDOWS_NR which is out of bound for fimd_context.win_data. Signed-off-by: Krzysztof Kozlowski Signed-off-by: Inki Dae --- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c index 97c61db..279c3f8 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c @@ -381,7 +381,7 @@ static void fimd_win_mode_set(struct device *dev, if (win == DEFAULT_ZPOS) win = ctx->default_win; - if (win < 0 || win > WINDOWS_NR) + if (win < 0 || win >= WINDOWS_NR) return; offset = overlay->fb_x * (overlay->bpp >> 3); @@ -506,7 +506,7 @@ static void fimd_win_commit(struct device *dev, int zpos) if (win == DEFAULT_ZPOS) win = ctx->default_win; - if (win < 0 || win > WINDOWS_NR) + if (win < 0 || win >= WINDOWS_NR) return; win_data = &ctx->win_data[win]; @@ -622,7 +622,7 @@ static void fimd_win_disable(struct device *dev, int zpos) if (win == DEFAULT_ZPOS) win = ctx->default_win; - if (win < 0 || win > WINDOWS_NR) + if (win < 0 || win >= WINDOWS_NR) return; win_data = &ctx->win_data[win];