lkml.org 
[lkml]   [2022]   [Mar]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v2 1/9] staging: r8188eu: use ieee80211 define for version check
Date
Use the IEEE80211_FCTL_VERS define to check the version number
of a received frame.

Covert IEEE80211_FCTL_VERS to le16 before using it as a mask for fc,
which is also an le16 value. The ieee80211_... helper functions use
the same approach.

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
v2
- fix a sparse warning, conver IEEE80211_FCTL_VERS to little endian

drivers/staging/r8188eu/core/rtw_recv.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_recv.c b/drivers/staging/r8188eu/core/rtw_recv.c
index 8800ea4825ff..fc7f2a559f9b 100644
--- a/drivers/staging/r8188eu/core/rtw_recv.c
+++ b/drivers/staging/r8188eu/core/rtw_recv.c
@@ -1063,7 +1063,6 @@ static int validate_recv_frame(struct adapter *adapter, struct recv_frame *precv
struct rx_pkt_attrib *pattrib = &precv_frame->attrib;
u8 *ptr = precv_frame->rx_data;
__le16 fc = *(__le16 *)ptr;
- u8 ver = (unsigned char)(*ptr) & 0x3;
struct mlme_ext_priv *pmlmeext = &adapter->mlmeextpriv;

if (pmlmeext->sitesurvey_res.state == SCAN_PROCESS) {
@@ -1072,8 +1071,7 @@ static int validate_recv_frame(struct adapter *adapter, struct recv_frame *precv
pmlmeext->channel_set[ch_set_idx].rx_count++;
}

- /* add version chk */
- if (ver != 0)
+ if ((fc & cpu_to_le16(IEEE80211_FCTL_VERS)) != 0)
return _FAIL;

pattrib->to_fr_ds = get_tofr_ds(ptr);
--
2.30.2
\
 
 \ /
  Last update: 2022-03-27 20:11    [W:0.145 / U:0.636 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site