From e61fc7cf90c9eb6af8380e2b02e28c60d4ee0ef5 Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Tue, 24 Jun 2014 15:03:22 +0200 Subject: [PATCH] staging: rtl8723au: Use _FIXED_IE_LEN_ instead of hard coded value This should help catching all the users once we stop carrying the fixed beacon elements in the IE array. Signed-off-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/core/rtw_mlme.c | 14 ++++++++------ drivers/staging/rtl8723au/core/rtw_mlme_ext.c | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/staging/rtl8723au/core/rtw_mlme.c b/drivers/staging/rtl8723au/core/rtw_mlme.c index b7a3528..66f24dc 100644 --- a/drivers/staging/rtl8723au/core/rtw_mlme.c +++ b/drivers/staging/rtl8723au/core/rtw_mlme.c @@ -1929,7 +1929,7 @@ int rtw_restruct_wmm_ie23a(struct rtw_adapter *adapter, u8 *in_ie, unsigned int ielength = 0; unsigned int i, j; - i = 12; /* after the fixed IE */ + i = _FIXED_IE_LENGTH_; /* after the fixed IE */ while (i < in_len) { ielength = initial_out_len; @@ -2039,8 +2039,8 @@ int rtw_restruct_sec_ie23a(struct rtw_adapter *adapter, u8 *in_ie, u8 *out_ie, "ndissecuritytype=%d\n", ndisauthmode, ndissecuritytype)); /* copy fixed ie only */ - memcpy(out_ie, in_ie, 12); - ielength = 12; + memcpy(out_ie, in_ie, _FIXED_IE_LENGTH_); + ielength = _FIXED_IE_LENGTH_; if (ndisauthmode == Ndis802_11AuthModeWPA || ndisauthmode == Ndis802_11AuthModeWPAPSK) authmode = WLAN_EID_VENDOR_SPECIFIC; @@ -2171,7 +2171,8 @@ bool rtw_restructure_ht_ie23a(struct rtw_adapter *padapter, u8 *in_ie, phtpriv->ht_option = false; - p = cfg80211_find_ie(WLAN_EID_HT_CAPABILITY, in_ie + 12, in_len -12); + p = cfg80211_find_ie(WLAN_EID_HT_CAPABILITY, in_ie + _FIXED_IE_LENGTH_, + in_len - _FIXED_IE_LENGTH_); if (p && p[1] > 0) { u32 rx_packet_offset, max_recvbuf_sz; @@ -2216,8 +2217,9 @@ bool rtw_restructure_ht_ie23a(struct rtw_adapter *padapter, u8 *in_ie, phtpriv->ht_option = true; - p = cfg80211_find_ie(WLAN_EID_HT_OPERATION, in_ie + 12, - in_len -12); + p = cfg80211_find_ie(WLAN_EID_HT_OPERATION, + in_ie + _FIXED_IE_LENGTH_, + in_len - _FIXED_IE_LENGTH_); if (p && (p[1] == sizeof(struct ieee80211_ht_operation))) { out_len = *pout_len; pframe = rtw_set_ie23a(out_ie + out_len, diff --git a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c index 03ced01..6791ad7 100644 --- a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c +++ b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c @@ -4254,7 +4254,7 @@ static struct wlan_bssid_ex *collect_bss_info(struct rtw_adapter *padapter, memcpy(bssid->SupportedRates + i, p + 2, p[1]); } - if (bssid->IELength < 12) + if (bssid->IELength < _FIXED_IE_LENGTH_) goto fail; /* Checking for DSConfig */ -- 2.7.4