[<prev] [next>] [day] [month] [year] [list]
Message-ID: <4B2659DB.8000309@gmail.com>
Date: Mon, 14 Dec 2009 16:29:31 +0100
From: Roel Kluin <roel.kluin@...il.com>
To: Samuel Ortiz <samuel@...tiz.org>, irda-users@...ts.sourceforge.net,
Andrew Morton <akpm@...ux-foundation.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: [PATCH] [IRDA]: ensure that index is within bounds in stir421x_patch_device()
Test whether the index is within bounds before testing the element.
Signed-off-by: Roel Kluin <roel.kluin@...il.com>
---
drivers/net/irda/irda-usb.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/net/irda/irda-usb.c b/drivers/net/irda/irda-usb.c
index e8e33bb..1b0bd32 100644
--- a/drivers/net/irda/irda-usb.c
+++ b/drivers/net/irda/irda-usb.c
@@ -1124,8 +1124,9 @@ static int stir421x_patch_device(struct irda_usb_cb *self)
* The actual image starts after the "STMP" keyword
* so forward to the firmware header tag
*/
- for (i = 0; (fw->data[i] != STIR421X_PATCH_END_OF_HDR_TAG) &&
- (i < fw->size); i++) ;
+ for (i = 0; i < fw->size; i++)
+ if (fw->data[i] == STIR421X_PATCH_END_OF_HDR_TAG)
+ break;
/* here we check for the out of buffer case */
if ((STIR421X_PATCH_END_OF_HDR_TAG == fw->data[i]) &&
(i < STIR421X_PATCH_CODE_OFFSET)) {
--
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