staging: off by one in AsicSendCommandToMcu() and NDIS_STATUS NICLoadFirmware()
PATCH 1/1 staging: off by one in AsicSendCommandToMcu() and NDIS_STATUS NICLoadFirmware()
With a postfix increment i/Index is incremented beyond 100/1000 so the message will be displayed too soon.
---
This could occur almost never.
drivers/staging/rt2860/common/mlme.c | 2 +- drivers/staging/rt2860/common/rtmp_init.c | 2 +- drivers/staging/rt2870/common/mlme.c | 2 +- drivers/staging/rt2870/common/rtmp_init.c | 2 +- drivers/staging/rt3070/common/mlme.c | 2 +- drivers/staging/rt3070/common/rtmp_init.c | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-)
drivers/staging/rt2860/common/mlme.c +1 -1
@@ -7611,7 +7611,7 @@ BOOLEAN AsicSendCommandToMcu(RTMPusecDelay (2 ); }while (i++ <100 ); -if (i >=100 ) +if (i >100 ) {#ifdef RALINK_ATE if (pAd->ate.bFWLoading == TRUE)
drivers/staging/rt2860/common/rtmp_init.c +1 -1
@@ -2867,7 +2867,7 @@ NDIS_STATUS NICLoadFirmware(RTMPusecDelay (1000 ); }while (Index++ <1000 ); -if (Index >=1000 ) +if (Index >1000 ) { Status =NDIS_STATUS_FAILURE ;DBGPRINT (RT_DEBUG_ERROR , ("NICLoadFirmware: MCU is not ready\n\n\n" ));
drivers/staging/rt2870/common/mlme.c +1 -1
@@ -7575,7 +7575,7 @@ BOOLEAN AsicSendCommandToMcu(RTMPusecDelay (2 ); }while (i++ <100 ); -if (i >=100 ) +if (i >100 ) { {DBGPRINT_ERR (("H2M_MAILBOX still hold by MCU. command fail\n" ));
drivers/staging/rt2870/common/rtmp_init.c +1 -1
@@ -3016,7 +3016,7 @@ NDIS_STATUS NICLoadFirmware(RTMPusecDelay (1000 ); }while (Index++ <1000 ); -if (Index >=1000 ) +if (Index >1000 ) { Status =NDIS_STATUS_FAILURE ;DBGPRINT (RT_DEBUG_ERROR , ("NICLoadFirmware: MCU is not ready\n\n\n" ));
drivers/staging/rt3070/common/mlme.c +1 -1
@@ -7959,7 +7959,7 @@ BOOLEAN AsicSendCommandToMcu(RTMPusecDelay (2 ); }while (i++ <100 ); -if (i >=100 ) +if (i >100 ) { {DBGPRINT_ERR (("H2M_MAILBOX still hold by MCU. command fail\n" ));
drivers/staging/rt3070/common/rtmp_init.c +1 -1
@@ -3181,7 +3181,7 @@ NDIS_STATUS NICLoadFirmware(RTMPusecDelay (1000 ); }while (Index++ <1000 ); -if (Index >=1000 ) +if (Index >1000 ) { Status =NDIS_STATUS_FAILURE ;DBGPRINT (RT_DEBUG_ERROR , ("NICLoadFirmware: MCU is not ready\n\n\n" ));
[email protected]
Appliedpatch staging-rtlxxxx-off-by-one-in-asicsendcommandtomcu-and-ndis_status-nicloadfirmware.patch added to gregkh-2.6 tree
This is a note to let you know that I've just added the patch titled
Subject: staging: rtlxxxx: off by one in AsicSendCommandToMcu() and NDIS_STATUS NICLoadFirmware()
to my gregkh-2.6 tree. Its filename is
staging-rtlxxxx-off-by-one-in-asicsendcommandtomcu-and-ndis_status-nicloadfirmware.patch
This tree can be found at
http://www.kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/patches/
Quoted 1 line
From [email protected] Tue Jun 2 12:06:10 2009
From: Roel Kluin <[email protected]>
Date: Wed, 13 May 2009 20:37:54 +0200
Subject: staging: rtlxxxx: off by one in AsicSendCommandToMcu() and NDIS_STATUS NICLoadFirmware()
To: Greg KH <[email protected]>
Cc: lkml <[email protected]>, Andrew Morton <[email protected]>
Message-ID: <[email protected]>
With a postfix increment i/Index is incremented beyond 100/1000 so the message will be displayed too soon.
--- drivers/staging/rt2860/common/mlme.c | 2 +- drivers/staging/rt2860/common/rtmp_init.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/staging/rt2860/common/mlme.c +1 -1
@@ -7866,7 +7866,7 @@ BOOLEAN AsicSendCommandToMcu(RTMPusecDelay (2 ); }while (i++ <100 ); -if (i >=100 ) +if (i >100 ) { {#ifdef RT2860
drivers/staging/rt2860/common/rtmp_init.c +1 -1
@@ -3366,7 +3366,7 @@ NDIS_STATUS NICLoadFirmware(RTMPusecDelay (1000 ); }while (Index++ <1000 ); -if (Index >=1000 ) +if (Index >1000 ) { Status =NDIS_STATUS_FAILURE ;DBGPRINT (RT_DEBUG_ERROR , ("NICLoadFirmware: MCU is not ready\n\n\n" ));