staging: rtl8723au: rtw_add_beacon(): Replace magic constant with appropriate struct size
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
143ced27ac
commit
db97812c2c
|
@ -2912,7 +2912,7 @@ static int rtw_add_beacon(struct rtw_adapter *adapter, const u8 *head,
|
||||||
size_t head_len, const u8 *tail, size_t tail_len)
|
size_t head_len, const u8 *tail, size_t tail_len)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
u8 *pbuf = NULL;
|
u8 *pbuf;
|
||||||
uint len, wps_ielen = 0;
|
uint len, wps_ielen = 0;
|
||||||
struct mlme_priv *pmlmepriv = &adapter->mlmepriv;
|
struct mlme_priv *pmlmepriv = &adapter->mlmepriv;
|
||||||
/* struct sta_priv *pstapriv = &padapter->stapriv; */
|
/* struct sta_priv *pstapriv = &padapter->stapriv; */
|
||||||
|
@ -2923,17 +2923,19 @@ static int rtw_add_beacon(struct rtw_adapter *adapter, const u8 *head,
|
||||||
if (check_fwstate(pmlmepriv, WIFI_AP_STATE) != true)
|
if (check_fwstate(pmlmepriv, WIFI_AP_STATE) != true)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (head_len < 24)
|
if (head_len < sizeof(struct ieee80211_hdr_3addr))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
pbuf = kzalloc(head_len + tail_len, GFP_KERNEL);
|
pbuf = kzalloc(head_len + tail_len, GFP_KERNEL);
|
||||||
if (!pbuf)
|
if (!pbuf)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
/* 24 = beacon header len. */
|
/* 24 = beacon header len. */
|
||||||
memcpy(pbuf, (void *)head + 24, head_len - 24);
|
memcpy(pbuf, (void *)head + sizeof(struct ieee80211_hdr_3addr),
|
||||||
memcpy(pbuf + head_len - 24, (void *)tail, tail_len);
|
head_len - sizeof(struct ieee80211_hdr_3addr));
|
||||||
|
memcpy(pbuf + head_len - sizeof(struct ieee80211_hdr_3addr),
|
||||||
|
(void *)tail, tail_len);
|
||||||
|
|
||||||
len = head_len + tail_len - 24;
|
len = head_len + tail_len - sizeof(struct ieee80211_hdr_3addr);
|
||||||
|
|
||||||
/* check wps ie if inclued */
|
/* check wps ie if inclued */
|
||||||
if (cfg80211_find_vendor_ie(WLAN_OUI_MICROSOFT,
|
if (cfg80211_find_vendor_ie(WLAN_OUI_MICROSOFT,
|
||||||
|
|
Loading…
Reference in New Issue