* [PATCH] [IRDA]: ensure that index is within bounds in stir421x_patch_device()
@ 2009-12-14 15:29 Roel Kluin
0 siblings, 0 replies; only message in thread
From: Roel Kluin @ 2009-12-14 15:29 UTC (permalink / raw)
To: Samuel Ortiz, irda-users, Andrew Morton, LKML
Test whether the index is within bounds before testing the element.
Signed-off-by: Roel Kluin <roel.kluin@gmail.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)) {
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2009-12-14 15:27 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-14 15:29 [PATCH] [IRDA]: ensure that index is within bounds in stir421x_patch_device() Roel Kluin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox