2011-06-29 06:32:51

by Dan Carpenter

[permalink] [raw]
Subject: [patch] rtlwifi: potential forever loop in rtl92de_hw_init()

"i" should be an int here because we are trying to use it to count
to 10000. The original code looks like it could hang in a forever
loop.

Signed-off-by: Dan Carpenter <[email protected]>
---
If we exit the loop via a timeout, that error isn't handled. Should
we limp along, or return an error?

diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/hw.c b/drivers/net/wireless/rtlwifi/rtl8192de/hw.c
index eedfb38..cbc0f40 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192de/hw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192de/hw.c
@@ -908,7 +908,8 @@ int rtl92de_hw_init(struct ieee80211_hw *hw)
struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
bool rtstatus = true;
- u8 tmp_u1b, i;
+ u8 tmp_u1b;
+ int i;
int err;
unsigned long flags;



2011-06-29 13:46:58

by Larry Finger

[permalink] [raw]
Subject: Re: [patch] rtlwifi: potential forever loop in rtl92de_hw_init()

On 06/29/2011 01:31 AM, Dan Carpenter wrote:
> "i" should be an int here because we are trying to use it to count
> to 10000. The original code looks like it could hang in a forever
> loop.
>
> Signed-off-by: Dan Carpenter<[email protected]>
> ---
> If we exit the loop via a timeout, that error isn't handled. Should
> we limp along, or return an error?

ACKed-by: Larry Finger <[email protected]>

Dan,

Thanks for this part. After another look at this routine, there are a couple of
places that need to be fixed. I will take care of that.

Larry

>
> diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/hw.c b/drivers/net/wireless/rtlwifi/rtl8192de/hw.c
> index eedfb38..cbc0f40 100644
> --- a/drivers/net/wireless/rtlwifi/rtl8192de/hw.c
> +++ b/drivers/net/wireless/rtlwifi/rtl8192de/hw.c
> @@ -908,7 +908,8 @@ int rtl92de_hw_init(struct ieee80211_hw *hw)
> struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
> struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
> bool rtstatus = true;
> - u8 tmp_u1b, i;
> + u8 tmp_u1b;
> + int i;
> int err;
> unsigned long flags;
>
>