LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [2.6 patch] i2c-amd756.c: fix off-by-one
@ 2008-02-27 21:21 Adrian Bunk
  2008-02-28 20:05 ` Jean Delvare
  0 siblings, 1 reply; 2+ messages in thread
From: Adrian Bunk @ 2008-02-27 21:21 UTC (permalink / raw)
  To: Jean Delvare; +Cc: i2c, linux-kernel

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) {


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [2.6 patch] i2c-amd756.c: fix off-by-one
  2008-02-27 21:21 [2.6 patch] i2c-amd756.c: fix off-by-one Adrian Bunk
@ 2008-02-28 20:05 ` Jean Delvare
  0 siblings, 0 replies; 2+ messages in thread
From: Jean Delvare @ 2008-02-28 20:05 UTC (permalink / raw)
  To: Adrian Bunk; +Cc: i2c, linux-kernel

Hi Adrian,

On Wed, 27 Feb 2008 23:21:09 +0200, Adrian Bunk wrote:
> 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) {
> 

Good catch, not sure how I managed to mess it up that way. Patch
applied, thank you.

-- 
Jean Delvare

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-02-28 20:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-27 21:21 [2.6 patch] i2c-amd756.c: fix off-by-one Adrian Bunk
2008-02-28 20:05 ` Jean Delvare

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).