[2.6 patch] i2c-amd756.c: fix off-by-one

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Adrian Bunk
Date: Wednesday, February 27, 2008 - 2:21 pm

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

Signed-off-by: Adrian Bunk <bunk@kernel.org>

---
f9829dd0d7dad9cbc08da3fceb105478e85c4137 foobar
diff --git a/drivers/i2c/busses/i2c-amd756.c b/drivers/i2c/busses/i2c-amd756.c
index 573abe4..2fa4318 100644
--- a/drivers/i2c/busses/i2c-amd756.c
+++ b/drivers/i2c/busses/i2c-amd756.c
@@ -335,7 +335,7 @@ static int __devinit amd756_probe(struct pci_dev *pdev,
 	u8 temp;
 	
 	/* driver_data might come from user-space, so check it */
-	if (id->driver_data > ARRAY_SIZE(chipname))
+	if (id->driver_data >= ARRAY_SIZE(chipname))
 		return -EINVAL;
 
 	if (amd756_ioport) {

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[2.6 patch] i2c-amd756.c: fix off-by-one, Adrian Bunk, (Wed Feb 27, 2:21 pm)
Re: [2.6 patch] i2c-amd756.c: fix off-by-one, Jean Delvare, (Thu Feb 28, 1:05 pm)