lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20171204145347.597518-1-arnd@arndb.de>
Date:   Mon,  4 Dec 2017 15:53:35 +0100
From:   Arnd Bergmann <arnd@...db.de>
To:     Philipp Zabel <p.zabel@...gutronix.de>
Cc:     Arnd Bergmann <arnd@...db.de>,
        Lucas Stach <l.stach@...gutronix.de>,
        dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org
Subject: [PATCH] gpu: ipu-v3: prg: avoid possible array underflow

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@...db.de>
---
 drivers/gpu/ipu-v3/ipu-prg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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);
-- 
2.9.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ