From 856e392531a1a06aa61110409c6a9d0fa2a878ed Mon Sep 17 00:00:00 2001 From: kimocoder Date: Sat, 1 Feb 2020 09:04:01 +0100 Subject: [PATCH] Some tweaks around the code --- core/rtw_ap.c | 2 +- core/rtw_mlme_ext.c | 17 ++++++++++++++--- include/rtw_byteorder.h | 12 ++++++++++++ os_dep/linux/ioctl_cfg80211.c | 1 + 4 files changed, 28 insertions(+), 4 deletions(-) diff --git a/core/rtw_ap.c b/core/rtw_ap.c index 956754d..afa2482 100644 --- a/core/rtw_ap.c +++ b/core/rtw_ap.c @@ -171,7 +171,7 @@ void rtw_add_bcn_ie(_adapter *padapter, WLAN_BSSID_EX *pnetwork, u8 index, u8 *d u8 bmatch = _FALSE; u8 *pie = pnetwork->IEs; u8 *p = NULL, *dst_ie = NULL, *premainder_ie = NULL, *pbackup_remainder_ie = NULL; - u32 i, offset, ielen, ie_offset, remainder_ielen = 0; + u32 i, offset, ielen = 0, ie_offset, remainder_ielen = 0; for (i = sizeof(NDIS_802_11_FIXED_IEs); i < pnetwork->IELength;) { pIE = (PNDIS_802_11_VARIABLE_IEs)(pnetwork->IEs + i); diff --git a/core/rtw_mlme_ext.c b/core/rtw_mlme_ext.c index 34b9fa9..79cbe2d 100644 --- a/core/rtw_mlme_ext.c +++ b/core/rtw_mlme_ext.c @@ -3739,8 +3739,10 @@ void issue_p2p_GO_request(_adapter *padapter, u8 *raddr) u8 action = P2P_PUB_ACTION_ACTION; u32 p2poui = cpu_to_be32(P2POUI); u8 oui_subtype = P2P_GO_NEGO_REQ; - u8 wpsie[255] = { 0x00 }, p2pie[255] = { 0x00 }; - u8 wpsielen = 0, p2pielen = 0; + u8 *wpsie; + u8 p2pie[ 255 ] = { 0x00 }; + u8 p2pielen = 0; + u8 wpsielen = 0; u16 len_channellist_attr = 0; #ifdef CONFIG_WFD u32 wfdielen = 0; @@ -3760,6 +3762,8 @@ void issue_p2p_GO_request(_adapter *padapter, u8 *raddr) if (pmgntframe == NULL) return; + wpsie = rtw_zmalloc(256); + RTW_INFO("[%s] In\n", __FUNCTION__); /* update attribute */ pattrib = &pmgntframe->attrib; @@ -4123,6 +4127,8 @@ void issue_p2p_GO_request(_adapter *padapter, u8 *raddr) dump_mgntframe(padapter, pmgntframe); + kfree(wpsie); + return; } @@ -4135,7 +4141,8 @@ void issue_p2p_GO_response(_adapter *padapter, u8 *raddr, u8 *frame_body, uint l u8 action = P2P_PUB_ACTION_ACTION; u32 p2poui = cpu_to_be32(P2POUI); u8 oui_subtype = P2P_GO_NEGO_RESP; - u8 wpsie[255] = { 0x00 }, p2pie[255] = { 0x00 }; + u8 *wpsie; + u8 p2pie[ 255 ] = { 0x00 }; u8 p2pielen = 0; uint wpsielen = 0; u16 wps_devicepassword_id = 0x0000; @@ -4159,6 +4166,8 @@ void issue_p2p_GO_response(_adapter *padapter, u8 *raddr, u8 *frame_body, uint l if (pmgntframe == NULL) return; + wpsie = rtw_zmalloc(256); + RTW_INFO("[%s] In, result = %d\n", __FUNCTION__, result); /* update attribute */ pattrib = &pmgntframe->attrib; @@ -4541,6 +4550,8 @@ void issue_p2p_GO_response(_adapter *padapter, u8 *raddr, u8 *frame_body, uint l dump_mgntframe(padapter, pmgntframe); + kfree(wpsie); + return; } diff --git a/include/rtw_byteorder.h b/include/rtw_byteorder.h index 8e6bb7a..5177310 100644 --- a/include/rtw_byteorder.h +++ b/include/rtw_byteorder.h @@ -20,6 +20,18 @@ #error "Shall be CONFIG_LITTLE_ENDIAN or CONFIG_BIG_ENDIAN, but not both!\n" #endif +#if !((defined CONFIG_LITTLE_ENDIAN) || (defined CONFIG_BIG_ENDIAN)) +#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ +#define CONFIG_LITTLE_ENDIAN +//#warning "Auto-detected little-endian system...hope it is correct!" +#else +#if __BYTE_ORDER == __BIG_ENDIAN +//#warning "Auto-detected big-endian system...hope it is correct!" +#define CONFIG_BIG_ENDIAN +#endif +#endif +#endif + #if defined(CONFIG_LITTLE_ENDIAN) #ifndef CONFIG_PLATFORM_MSTAR389 #include diff --git a/os_dep/linux/ioctl_cfg80211.c b/os_dep/linux/ioctl_cfg80211.c index 9057bee..f32b23b 100644 --- a/os_dep/linux/ioctl_cfg80211.c +++ b/os_dep/linux/ioctl_cfg80211.c @@ -4438,6 +4438,7 @@ void rtw_cfg80211_indicate_sta_assoc(_adapter *padapter, u8 *pmgmt_frame, uint f { struct station_info sinfo; u8 ie_offset; + _rtw_memset(&sinfo, 0, sizeof(struct station_info)); if (get_frame_sub_type(pmgmt_frame) == WIFI_ASSOCREQ) ie_offset = _ASOCREQ_IE_OFFSET_; else /* WIFI_REASSOCREQ */