linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rtlwifi: rtl8821ae: Fix HW_VAR_NAV_UPPER operation
@ 2017-07-13  7:43 Dan Carpenter
  2017-07-14 19:09 ` Larry Finger
  2017-07-28 15:43 ` Kalle Valo
  0 siblings, 2 replies; 4+ messages in thread
From: Dan Carpenter @ 2017-07-13  7:43 UTC (permalink / raw)
  To: Larry Finger
  Cc: Chaoming Li, Kalle Valo, Ping-Ke Shih, Masanari Iida,
	linux-wireless, kernel-janitors

The cast here is wrong.  We want to cast the pointer but we accidentally
do a no-op cast of the value.  We normally want to set us_nav_upper to
WIFI_NAV_UPPER_US (30000) but because of this bug we instead set it to
184 on little endian systems and 0 on big endian ones.

Fixes: 3c05bedb5fef ("Staging: rtl8812ae: Add Realtek 8821 PCI WIFI driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c
index 2bc6bace069c..230f92a48f3c 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c
@@ -779,7 +779,7 @@ void rtl8821ae_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
 			_rtl8821ae_resume_tx_beacon(hw);
 		break; }
 	case HW_VAR_NAV_UPPER: {
-		u32	us_nav_upper = ((u32)*val);
+		u32	us_nav_upper = *(u32 *)val;
 
 		if (us_nav_upper > HAL_92C_NAV_UPPER_UNIT * 0xFF) {
 			RT_TRACE(rtlpriv, COMP_INIT , DBG_WARNING,

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

* Re: [PATCH] rtlwifi: rtl8821ae: Fix HW_VAR_NAV_UPPER operation
  2017-07-13  7:43 [PATCH] rtlwifi: rtl8821ae: Fix HW_VAR_NAV_UPPER operation Dan Carpenter
@ 2017-07-14 19:09 ` Larry Finger
  2017-07-15  7:40   ` Dan Carpenter
  2017-07-28 15:43 ` Kalle Valo
  1 sibling, 1 reply; 4+ messages in thread
From: Larry Finger @ 2017-07-14 19:09 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Chaoming Li, Kalle Valo, Ping-Ke Shih, Masanari Iida,
	linux-wireless, kernel-janitors

On 07/13/2017 02:43 AM, Dan Carpenter wrote:
> The cast here is wrong.  We want to cast the pointer but we accidentally
> do a no-op cast of the value.  We normally want to set us_nav_upper to
> WIFI_NAV_UPPER_US (30000) but because of this bug we instead set it to
> 184 on little endian systems and 0 on big endian ones.
> 
> Fixes: 3c05bedb5fef ("Staging: rtl8812ae: Add Realtek 8821 PCI WIFI driver")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

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

Thanks for catching this error. I suspect a typo, but your fix is obviously correct.

Does the "Fixes" notation imply a Cc to stable? If not, then the patch needs a 
Cc to stable for 3.14+.

Thanks again,

Larry

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

* Re: [PATCH] rtlwifi: rtl8821ae: Fix HW_VAR_NAV_UPPER operation
  2017-07-14 19:09 ` Larry Finger
@ 2017-07-15  7:40   ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2017-07-15  7:40 UTC (permalink / raw)
  To: Larry Finger
  Cc: Chaoming Li, Kalle Valo, Ping-Ke Shih, Masanari Iida,
	linux-wireless, kernel-janitors

On Fri, Jul 14, 2017 at 02:09:46PM -0500, Larry Finger wrote:
> On 07/13/2017 02:43 AM, Dan Carpenter wrote:
> > The cast here is wrong.  We want to cast the pointer but we accidentally
> > do a no-op cast of the value.  We normally want to set us_nav_upper to
> > WIFI_NAV_UPPER_US (30000) but because of this bug we instead set it to
> > 184 on little endian systems and 0 on big endian ones.
> > 
> > Fixes: 3c05bedb5fef ("Staging: rtl8812ae: Add Realtek 8821 PCI WIFI driver")
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
> 
> Thanks for catching this error. I suspect a typo, but your fix is obviously correct.
> 
> Does the "Fixes" notation imply a Cc to stable?

No.  Fixes doesn't necessarily imply a Cc to stable.

regards,
dan carpenter

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

* Re: rtlwifi: rtl8821ae: Fix HW_VAR_NAV_UPPER operation
  2017-07-13  7:43 [PATCH] rtlwifi: rtl8821ae: Fix HW_VAR_NAV_UPPER operation Dan Carpenter
  2017-07-14 19:09 ` Larry Finger
@ 2017-07-28 15:43 ` Kalle Valo
  1 sibling, 0 replies; 4+ messages in thread
From: Kalle Valo @ 2017-07-28 15:43 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Larry Finger, Chaoming Li, Ping-Ke Shih, Masanari Iida,
	linux-wireless, kernel-janitors

Dan Carpenter <dan.carpenter@oracle.com> wrote:

> The cast here is wrong.  We want to cast the pointer but we accidentally
> do a no-op cast of the value.  We normally want to set us_nav_upper to
> WIFI_NAV_UPPER_US (30000) but because of this bug we instead set it to
> 184 on little endian systems and 0 on big endian ones.
> 
> Fixes: 3c05bedb5fef ("Staging: rtl8812ae: Add Realtek 8821 PCI WIFI driver")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
> 
> diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c
> index 2bc6bace069c..230f92a48f3c 100644
> --- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c
> +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c
> @@ -779,7 +779,7 @@ void rtl8821ae_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
>  			_rtl8821ae_resume_tx_beacon(hw);
>  		break; }
>  	case HW_VAR_NAV_UPPER: {
> -		u32	us_nav_upper = ((u32)*val);
> +		u32	us_nav_upper = *(u32 *)val;
>  
>  		if (us_nav_upper > HAL_92C_NAV_UPPER_UNIT * 0xFF) {
>  			RT_TRACE(rtlpriv, COMP_INIT , DBG_WARNING,

Patch applied to wireless-drivers-next.git, thanks.

d28ac7be15c7 rtlwifi: rtl8821ae: Fix HW_VAR_NAV_UPPER operation

-- 
https://patchwork.kernel.org/patch/9837847/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

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

end of thread, other threads:[~2017-07-28 15:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-13  7:43 [PATCH] rtlwifi: rtl8821ae: Fix HW_VAR_NAV_UPPER operation Dan Carpenter
2017-07-14 19:09 ` Larry Finger
2017-07-15  7:40   ` Dan Carpenter
2017-07-28 15:43 ` Kalle Valo

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).