public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: off by one in AsicSendCommandToMcu() and NDIS_STATUS NICLoadFirmware()
@ 2009-05-13 18:37 Roel Kluin
  2009-06-02 19:43 ` patch staging-rtlxxxx-off-by-one-in-asicsendcommandtomcu-and-ndis_status-nicloadfirmware.patch added to gregkh-2.6 tree gregkh
  0 siblings, 1 reply; 2+ messages in thread
From: Roel Kluin @ 2009-05-13 18:37 UTC (permalink / raw)
  To: Greg KH; +Cc: lkml, Andrew Morton

With a postfix increment i/Index is incremented beyond 100/1000 so the
message will be displayed too soon.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
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(-)

diff --git a/drivers/staging/rt2860/common/mlme.c b/drivers/staging/rt2860/common/mlme.c
index c00f9ab..b76eecc 100644
--- a/drivers/staging/rt2860/common/mlme.c
+++ b/drivers/staging/rt2860/common/mlme.c
@@ -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)
diff --git a/drivers/staging/rt2860/common/rtmp_init.c b/drivers/staging/rt2860/common/rtmp_init.c
index 8a00cee..6321352 100644
--- a/drivers/staging/rt2860/common/rtmp_init.c
+++ b/drivers/staging/rt2860/common/rtmp_init.c
@@ -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"));
diff --git a/drivers/staging/rt2870/common/mlme.c b/drivers/staging/rt2870/common/mlme.c
index 8a82cee..8598c6e 100644
--- a/drivers/staging/rt2870/common/mlme.c
+++ b/drivers/staging/rt2870/common/mlme.c
@@ -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"));
diff --git a/drivers/staging/rt2870/common/rtmp_init.c b/drivers/staging/rt2870/common/rtmp_init.c
index 099b6a8..2940ca3 100644
--- a/drivers/staging/rt2870/common/rtmp_init.c
+++ b/drivers/staging/rt2870/common/rtmp_init.c
@@ -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"));
diff --git a/drivers/staging/rt3070/common/mlme.c b/drivers/staging/rt3070/common/mlme.c
index 0ffbfa3..3e697cd 100644
--- a/drivers/staging/rt3070/common/mlme.c
+++ b/drivers/staging/rt3070/common/mlme.c
@@ -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"));
diff --git a/drivers/staging/rt3070/common/rtmp_init.c b/drivers/staging/rt3070/common/rtmp_init.c
index 4503f6c..8791b7b 100644
--- a/drivers/staging/rt3070/common/rtmp_init.c
+++ b/drivers/staging/rt3070/common/rtmp_init.c
@@ -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"));

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

* patch staging-rtlxxxx-off-by-one-in-asicsendcommandtomcu-and-ndis_status-nicloadfirmware.patch added to gregkh-2.6 tree
  2009-05-13 18:37 [PATCH] staging: off by one in AsicSendCommandToMcu() and NDIS_STATUS NICLoadFirmware() Roel Kluin
@ 2009-06-02 19:43 ` gregkh
  0 siblings, 0 replies; 2+ messages in thread
From: gregkh @ 2009-06-02 19:43 UTC (permalink / raw)
  To: roel.kluin, akpm, gregkh, linux-kernel


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/


>From roel.kluin@gmail.com  Tue Jun  2 12:06:10 2009
From: Roel Kluin <roel.kluin@gmail.com>
Date: Wed, 13 May 2009 20:37:54 +0200
Subject: staging: rtlxxxx: off by one in AsicSendCommandToMcu() and NDIS_STATUS NICLoadFirmware()
To: Greg KH <gregkh@suse.de>
Cc: lkml <linux-kernel@vger.kernel.org>, Andrew Morton <akpm@linux-foundation.org>
Message-ID: <4A0B1382.6040501@gmail.com>


With a postfix increment i/Index is incremented beyond 100/1000 so the
message will be displayed too soon.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
 drivers/staging/rt2860/common/mlme.c      |    2 +-
 drivers/staging/rt2860/common/rtmp_init.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/staging/rt2860/common/mlme.c
+++ b/drivers/staging/rt2860/common/mlme.c
@@ -7866,7 +7866,7 @@ BOOLEAN AsicSendCommandToMcu(
 		RTMPusecDelay(2);
 	} while(i++ < 100);
 
-	if (i >= 100)
+	if (i > 100)
 	{
 		{
 #ifdef RT2860
--- a/drivers/staging/rt2860/common/rtmp_init.c
+++ b/drivers/staging/rt2860/common/rtmp_init.c
@@ -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"));


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

end of thread, other threads:[~2009-06-02 19:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-13 18:37 [PATCH] staging: off by one in AsicSendCommandToMcu() and NDIS_STATUS NICLoadFirmware() Roel Kluin
2009-06-02 19:43 ` patch staging-rtlxxxx-off-by-one-in-asicsendcommandtomcu-and-ndis_status-nicloadfirmware.patch added to gregkh-2.6 tree gregkh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox