Message ID | 20171204145347.597518-1-arnd@arndb.de |
---|---|
State | New |
Headers | show
Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp4529482qgn; Mon, 4 Dec 2017 06:53:58 -0800 (PST) X-Google-Smtp-Source: AGs4zMZDoNaQ6FUBOFEHGMmXg35LuaXY3HjssbzkcK1cggtlNQ8hpOzeHWr0Hu1bRFD4FDC7Whtd X-Received: by 10.101.76.65 with SMTP id l1mr14357557pgr.323.1512399238261; Mon, 04 Dec 2017 06:53:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512399238; cv=none; d=google.com; s=arc-20160816; b=KES96A2TmsL2OIY0jPtYX3GfGOrbYePTah0DP5MvbgzR8CLaz/PsoPQ7LWrq84C/yt FU1Bz0Zir7wRJIpCHbNTZdjX4SerO17T6F+J4GvDmtojbDlCDnc8yGcF3aNqkzewkJU4 TO0cS2z5dpTD9OVcH27Dis1vM02GJjMemzn+oNfWZdLx3n5EJDHGWJfGKrIS+lM6MgqQ bRT3GLHTRs8n/J1o6LY20jr6pbxgKh/l6op9hZPeZRPrwnhyouaDJBT6vXepxCOTUtdK Inuf99F1oJHBy86jucO90rf+FcqxGv0NCy4uf3Bnzog3fbQ2VPeS8pSF/qJpd5AxyZPn 6RgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:cc:message-id:date:subject:to:from:delivered-to :arc-authentication-results; bh=DIItzZWNfR0dxM2VQnndx920pSxu2lzZKefxDX0OFEg=; b=xXNzEejKnoRpcuDoHhz060KiWbOjQbcHu+/LGAskua83YseHtY7SQDN28AmS04Rc/W 5TaANA4uTC+a1s6suwQtLCkRa17bsueFAZ2cN0GktXMkrIPdTHxPsKgi8Fp8RbtVeDwX kO2n679jXgwe9qOGgvB4kWLqvNfEo0y7yRmWhxRTSI33sWsH/XC3hqWDXDRFJXUQkTi2 U+4Bb38bWfe86bBKJ5tNDtUZD3vfw6qFh6kKlwdXeLH7RdzAOqR7a5n38Kedz84LTypQ f2gqqnX+Ac9QiDF8zxeVkCyWUcPqMeNgPKzxzdSmGmSlZ1+q2B5K7u97KN8DMPLQKFaY hbNg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Return-Path: <dri-devel-bounces@lists.freedesktop.org> Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id u10si9433642pgr.811.2017.12.04.06.53.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Dec 2017 06:53:58 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7931A6E367; Mon, 4 Dec 2017 14:53:57 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.17.10]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5664F6E367 for <dri-devel@lists.freedesktop.org>; Mon, 4 Dec 2017 14:53:55 +0000 (UTC) Received: from wuerfel.lan ([149.172.96.106]) by mrelayeu.kundenserver.de (mreue105 [212.227.15.145]) with ESMTPA (Nemesis) id 0MGR4S-1eHSGZ3Wuu-00DFtg; Mon, 04 Dec 2017 15:53:47 +0100 From: Arnd Bergmann <arnd@arndb.de> To: Philipp Zabel <p.zabel@pengutronix.de> Subject: [PATCH] gpu: ipu-v3: prg: avoid possible array underflow Date: Mon, 4 Dec 2017 15:53:35 +0100 Message-Id: <20171204145347.597518-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:XntVzk4UHgboyykylPMDPh7qmET4dTy5XaodR6Lu7ME0b222Il5 gV6CqdloU0X5Uhc/WSqZc+AALrMX3QMOEy8AXAjhyAez+IJVNjUG/aA8GmLf2f5cA+LYdYj 7SbSe/IEWDiuiVPqExallx6dHOvq7w7lGnkYO/auLaJfhNZ9wl9ydA4eprcaMC0f06hRxnJ GMsdFEXBP3Q+LU9yoD4/g== X-UI-Out-Filterresults: notjunk:1; V01:K0:SBkRoq2UCGk=:t61Tn0EXhJ9EuZ4rUCJFJg XnmxEFilqLzdqI1sYil1qVbM0RWx1+SgHqqUC3csfOuuxzYLkpssbixggA3La+AFNbAp9gn38 nP8fkl0MbnpnV0lfiMIdGnnn+yvCip4qA4nX3kx0IxAoam/GgS+W74d5HpIoeKAaL2TjhZ4Zv mUyzMwR3jeU3Z7Gaxvwd5V/efrNOh/GOs/GS+aTVnQZN7zs3khaqZl/EQxfr0rs6CDfp9NGaO 1yAy1G+BSs132w0rIZ6B/ux/odNLeShnsIMo8paH24K8elmTNIAVuVxd8D/i4Jlg8zoLmcIEM w1TaQjtMMvwH2BhG1Zlf5kPgNyCKPMf4S+vgp3N/ZvLOl5oBwyr89Z/szyviDWr53a4IjMgq8 U62NUT9/Y+G6dWfRIGH4gH/QoWu3MMOprlRwNLp5kZrZjCzx9eB+xb6aXvPlxNP7fZhI5NM9V a8ZwG8izTmtJa+t9t+NwAFWIwuJqaY5BgLJIANqf4ZMOsqYFiiEPULodnDj/yP1eOuPqhYwpl KDBOUrIfL4/36CiqbpD1MSrzxO1/WOz2619npjmqkLScvr+asijjzMRmWitte2nWM5m8Nhyhe 66pLPCN1gQ61WbpxVMGgSvXJYQmlowPYG9UrwnzMaRrYXm1Q+NeWK376RUnVGR2YoXIDECgNv OJBbTHnOBfkh9K7fZqqhPhpzsaEsgVGo1fe8hAXAhcgIxsTg0dGQzBWvow9yQLk2ecVvrC1ss DSbAlbQCE/6UxVgr8EfprpIXMJyMEVxK/SiOqA== Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Arnd Bergmann <arnd@arndb.de> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development <dri-devel.lists.freedesktop.org> List-Unsubscribe: <https://lists.freedesktop.org/mailman/options/dri-devel>, <mailto:dri-devel-request@lists.freedesktop.org?subject=unsubscribe> List-Archive: <https://lists.freedesktop.org/archives/dri-devel> List-Post: <mailto:dri-devel@lists.freedesktop.org> List-Help: <mailto:dri-devel-request@lists.freedesktop.org?subject=help> List-Subscribe: <https://lists.freedesktop.org/mailman/listinfo/dri-devel>, <mailto:dri-devel-request@lists.freedesktop.org?subject=subscribe> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" <dri-devel-bounces@lists.freedesktop.org> |
Series |
gpu: ipu-v3: prg: avoid possible array underflow
|
expand
|
diff --git a/drivers/gpu/ipu-v3/ipu-prg.c b/drivers/gpu/ipu-v3/ipu-prg.c index 0013ca9f72c8..1417db856989 100644 --- a/drivers/gpu/ipu-v3/ipu-prg.c +++ b/drivers/gpu/ipu-v3/ipu-prg.c @@ -252,7 +252,7 @@ void ipu_prg_channel_disable(struct ipuv3_channel *ipu_chan) struct ipu_prg_channel *chan = &prg->chan[prg_chan]; u32 val; - if (!chan->enabled || prg_chan < 0) + if (prg_chan < 0 || !chan->enabled) return; clk_prepare_enable(prg->clk_ipg);
gcc-8 reports that we access an array with a negative index in an error case: drivers/gpu/ipu-v3/ipu-prg.c: In function 'ipu_prg_channel_disable': drivers/gpu/ipu-v3/ipu-prg.c:252:43: error: array subscript -22 is below array bounds of 'struct ipu_prg_channel[3]' [-Werror=array-bounds] This moves the range check in front of the dereference. Signed-off-by: Arnd Bergmann <arnd@arndb.de> --- drivers/gpu/ipu-v3/ipu-prg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)