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]
Date:	Mon, 19 Mar 2007 10:25:41 +0100
From:	Adrian Bunk <bunk@...sta.de>
To:	Ben Dooks <ben-linux@...ff.org>,
	Vincent Sanders <vince@....linux.org.uk>
Cc:	linux-kernel@...r.kernel.org
Subject: [2.6 patch] drivers/mfd/sm501.c: fix an off-by-one

This patch fixes an off-by-one spotted by the Coverity checker.

Signed-off-by: Adrian Bunk <bunk@...sta.de>

---
--- linux-2.6.21-rc3-mm2/drivers/mfd/sm501.c.old	2007-03-19 09:09:57.000000000 +0100
+++ linux-2.6.21-rc3-mm2/drivers/mfd/sm501.c	2007-03-19 09:15:12.000000000 +0100
@@ -314,17 +314,17 @@ int sm501_unit_power(struct device *dev,
 	mutex_lock(&sm->clock_lock);
 
 	mode = readl(sm->regs + SM501_POWER_MODE_CONTROL);
 	gate = readl(sm->regs + SM501_CURRENT_GATE);
 	clock = readl(sm->regs + SM501_CURRENT_CLOCK);
 
 	mode &= 3;		/* get current power mode */
 
-	if (unit > ARRAY_SIZE(sm->unit_power)) {
+	if (unit >= ARRAY_SIZE(sm->unit_power)) {
 		dev_err(dev, "%s: bad unit %d\n", __FUNCTION__, unit);
 		goto already;
 	}
 
 	dev_dbg(sm->dev, "%s: unit %d, cur %d, to %d\n", __FUNCTION__, unit,
 		sm->unit_power[unit], to);
 
 	if (to == 0 && sm->unit_power[unit] == 0) {

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ