linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] staging: rtl8188eu: fix HighestRate check in odm_ARFBRefresh_8188E()
@ 2019-09-26  7:31 Denis Efremov
  2019-09-26 17:17 ` Larry Finger
  0 siblings, 1 reply; 2+ messages in thread
From: Denis Efremov @ 2019-09-26  7:31 UTC (permalink / raw)
  To: devel
  Cc: Denis Efremov, linux-kernel, Larry Finger, Greg Kroah-Hartman,
	Michael Straube, stable

It's incorrect to compare HighestRate with 0x0b twice in the following
manner "if (HighestRate > 0x0b) ... else if (HighestRate > 0x0b) ...". The
"else if" branch is constantly false. The second comparision should be
with 0x03 according to the max_rate_idx in ODM_RAInfo_Init().

Cc: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Michael Straube <straube.linux@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: Denis Efremov <efremov@linux.com>
---
 drivers/staging/rtl8188eu/hal/hal8188e_rate_adaptive.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8188eu/hal/hal8188e_rate_adaptive.c b/drivers/staging/rtl8188eu/hal/hal8188e_rate_adaptive.c
index 9ddd51685063..5792f491b59a 100644
--- a/drivers/staging/rtl8188eu/hal/hal8188e_rate_adaptive.c
+++ b/drivers/staging/rtl8188eu/hal/hal8188e_rate_adaptive.c
@@ -409,7 +409,7 @@ static int odm_ARFBRefresh_8188E(struct odm_dm_struct *dm_odm, struct odm_ra_inf
 		pRaInfo->PTModeSS = 3;
 	else if (pRaInfo->HighestRate > 0x0b)
 		pRaInfo->PTModeSS = 2;
-	else if (pRaInfo->HighestRate > 0x0b)
+	else if (pRaInfo->HighestRate > 0x03)
 		pRaInfo->PTModeSS = 1;
 	else
 		pRaInfo->PTModeSS = 0;
-- 
2.21.0


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

* Re: [PATCH] staging: rtl8188eu: fix HighestRate check in odm_ARFBRefresh_8188E()
  2019-09-26  7:31 [PATCH] staging: rtl8188eu: fix HighestRate check in odm_ARFBRefresh_8188E() Denis Efremov
@ 2019-09-26 17:17 ` Larry Finger
  0 siblings, 0 replies; 2+ messages in thread
From: Larry Finger @ 2019-09-26 17:17 UTC (permalink / raw)
  To: Denis Efremov, devel
  Cc: linux-kernel, Greg Kroah-Hartman, Michael Straube, stable

On 9/26/19 2:31 AM, Denis Efremov wrote:
> It's incorrect to compare HighestRate with 0x0b twice in the following
> manner "if (HighestRate > 0x0b) ... else if (HighestRate > 0x0b) ...". The
> "else if" branch is constantly false. The second comparision should be
> with 0x03 according to the max_rate_idx in ODM_RAInfo_Init().
> 
> Cc: Larry Finger <Larry.Finger@lwfinger.net>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Michael Straube <straube.linux@gmail.com>
> Cc: stable@vger.kernel.org
> Signed-off-by: Denis Efremov <efremov@linux.com>
> ---
>   drivers/staging/rtl8188eu/hal/hal8188e_rate_adaptive.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/rtl8188eu/hal/hal8188e_rate_adaptive.c b/drivers/staging/rtl8188eu/hal/hal8188e_rate_adaptive.c
> index 9ddd51685063..5792f491b59a 100644
> --- a/drivers/staging/rtl8188eu/hal/hal8188e_rate_adaptive.c
> +++ b/drivers/staging/rtl8188eu/hal/hal8188e_rate_adaptive.c
> @@ -409,7 +409,7 @@ static int odm_ARFBRefresh_8188E(struct odm_dm_struct *dm_odm, struct odm_ra_inf
>   		pRaInfo->PTModeSS = 3;
>   	else if (pRaInfo->HighestRate > 0x0b)
>   		pRaInfo->PTModeSS = 2;
> -	else if (pRaInfo->HighestRate > 0x0b)
> +	else if (pRaInfo->HighestRate > 0x03)
>   		pRaInfo->PTModeSS = 1;
>   	else
>   		pRaInfo->PTModeSS = 0;
> 

I agree that the original code is wrong; however, I prefer that changes that 
alter the execution should be tested. I see no evidence that such testing has 
been done. It probably does not matter because a highest rate between 3 and 0xb 
means 802.11g is in use, and that may no longer be a real-world situation.

With any future patches, you need to indicate if testing has been done.

Acked-by: Larry Finger <Larry.Finger@lwfinger.net>

Larry


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

end of thread, other threads:[~2019-09-26 17:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-26  7:31 [PATCH] staging: rtl8188eu: fix HighestRate check in odm_ARFBRefresh_8188E() Denis Efremov
2019-09-26 17:17 ` Larry Finger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).