Commit ea1728b5 authored by Martin Kaiser's avatar Martin Kaiser Committed by Greg Kroah-Hartman
Browse files

staging: r8188eu: use ieee80211 define for version check



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: default avatarkernel test robot <lkp@intel.com>
Signed-off-by: default avatarMartin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220327180944.712545-2-martin@kaiser.cx


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent b4c5ec35
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -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);