[patch] off by one error in rioctrl.c

From: Dan Carpenter
Date: Fri Aug 07 2009 - 08:11:04 EST


I'm not sure who to send this to.

If DownLoad.ProductCode == MAX_PRODUCT, that would be a problem when we do
RIOBootTable[DownLoad.ProductCode] a couple lines down.

Found by smatch (http://repo.or.cz/w/smatch.git).

regards,
dan carpenter


Signed-off-by: Dan Carpenter <error27@xxxxxxxxx>

--- orig/drivers/char/rio/rioctrl.c 2009-08-03 21:44:01.000000000 +0200
+++ devel/drivers/char/rio/rioctrl.c 2009-08-03 21:44:26.000000000 +0200
@@ -873,7 +873,7 @@
/*
** It is important that the product code is an unsigned object!
*/
- if (DownLoad.ProductCode > MAX_PRODUCT) {
+ if (DownLoad.ProductCode >= MAX_PRODUCT) {
rio_dprintk(RIO_DEBUG_CTRL, "RIO_DOWNLOAD: Bad product code %d passed\n", DownLoad.ProductCode);
p->RIOError.Error = NO_SUCH_PRODUCT;
return -ENXIO;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/