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>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190330212300.11675-1-colin.king@canonical.com>
Date:   Sat, 30 Mar 2019 21:23:00 +0000
From:   Colin King <colin.king@...onical.com>
To:     Mark Brown <broonie@...nel.org>, linux-spi@...r.kernel.org
Cc:     kernel-janitors@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] spi: oc-tiny: fix negative loop bound error on for loop

From: Colin Ian King <colin.king@...onical.com>

Currently the for-loop using an unsigned int for the loop counter
which is problematic when comparing it to the signed int
gt->gpio_cs_count.  This is an issue because if the signed int is
negative (for example, the call to of_gpio_count failed) then
the negative loop bound is implicitly cast to an unsigned int on
the comparison to loop counter i and will yield a very large value,
eventually causing an array bounds overflow on hw->gpio_cs.

Fix this by simply making the loop counter i a signed int;

Fixes: ca632f556697 ("spi: reorganize drivers")
Signed-off-by: Colin Ian King <colin.king@...onical.com>
---
 drivers/spi/spi-oc-tiny.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/spi-oc-tiny.c b/drivers/spi/spi-oc-tiny.c
index 085f580be7ec..81f74b938dc9 100644
--- a/drivers/spi/spi-oc-tiny.c
+++ b/drivers/spi/spi-oc-tiny.c
@@ -206,7 +206,7 @@ static int tiny_spi_of_probe(struct platform_device *pdev)
 {
 	struct tiny_spi *hw = platform_get_drvdata(pdev);
 	struct device_node *np = pdev->dev.of_node;
-	unsigned int i;
+	int i;
 	u32 val;
 
 	if (!np)
-- 
2.20.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ