diff --git a/core/rtw_ap.c b/core/rtw_ap.c index 98848f5..3e890c5 100644 --- a/core/rtw_ap.c +++ b/core/rtw_ap.c @@ -4429,7 +4429,7 @@ static u8 rtw_ap_update_chbw_by_ifbmp(struct dvobj_priv *dvobj, u8 ifbmp int i; for (i = 0; i < dvobj->iface_nums; i++) { - if (!(ifbmp & BIT(i)) || !dvobj->padapters) + if (!(ifbmp & BIT(i)) || !dvobj->padapters[i]) continue; iface = dvobj->padapters[i]; @@ -4449,7 +4449,7 @@ static u8 rtw_ap_update_chbw_by_ifbmp(struct dvobj_priv *dvobj, u8 ifbmp } for (i = 0; i < dvobj->iface_nums; i++) { - if (!(ifbmp & BIT(i)) || !dvobj->padapters) + if (!(ifbmp & BIT(i)) || !dvobj->padapters[i]) continue; iface = dvobj->padapters[i]; @@ -4617,7 +4617,7 @@ u8 rtw_ap_chbw_decision(_adapter *adapter, u8 ifbmp, u8 excl_ifbmp #ifdef CONFIG_RTW_MESH for (i = 0; i < dvobj->iface_nums; i++) - if ((ifbmp & BIT(i)) && dvobj->padapters) + if ((ifbmp & BIT(i)) && dvobj->padapters[i]) if (!MLME_IS_MESH(dvobj->padapters[i])) break; ifbmp_all_mesh = i >= dvobj->iface_nums ? 1 : 0; diff --git a/core/rtw_br_ext.c b/core/rtw_br_ext.c index a2c491e..65e99fc 100644 --- a/core/rtw_br_ext.c +++ b/core/rtw_br_ext.c @@ -116,7 +116,7 @@ static int __nat25_add_pppoe_tag(struct sk_buff *skb, struct pppoe_tag *tag) /* have a room for new tag */ memmove(((unsigned char *)ph->tag + data_len), (unsigned char *)ph->tag, ntohs(ph->length)); ph->length = htons(ntohs(ph->length) + data_len); - memcpy((unsigned char *)ph->tag, tag, data_len); + memcpy((unsigned char *)ph->tag, tag, tag->tag_len); return data_len; } diff --git a/hal/phydm/halrf/halrf.c b/hal/phydm/halrf/halrf.c index 1ca6ef7..57f764f 100644 --- a/hal/phydm/halrf/halrf.c +++ b/hal/phydm/halrf/halrf.c @@ -923,8 +923,7 @@ void halrf_support_ability_debug(void *dm_void, char input[][16], u32 *_used, u8 i; for (i = 0; i < 5; i++) - if (input[i + 1]) - PHYDM_SSCANF(input[i + 2], DCMD_DECIMAL, &dm_value[i]); + PHYDM_SSCANF(input[i + 2], DCMD_DECIMAL, &dm_value[i]); if (dm_value[0] == 100) { PDM_SNPF(out_len, used, output + used, out_len - used, diff --git a/hal/phydm/halrf/halrf_debug.c b/hal/phydm/halrf/halrf_debug.c index b64c736..1975a5c 100644 --- a/hal/phydm/halrf/halrf_debug.c +++ b/hal/phydm/halrf/halrf_debug.c @@ -77,8 +77,7 @@ void halrf_debug_trace(void *dm_void, char input[][16], u32 *_used, u8 i; for (i = 0; i < 5; i++) - if (input[i + 1]) - PHYDM_SSCANF(input[i + 2], DCMD_DECIMAL, &rf_var[i]); + PHYDM_SSCANF(input[i + 2], DCMD_DECIMAL, &rf_var[i]); if (rf_var[0] == 100) { PDM_SNPF(out_len, used, output + used, out_len - used, @@ -214,11 +213,9 @@ void halrf_cmd_parser(void *dm_void, char input[][16], u32 *_used, char *output, case HALRF_IQK_DEBUG: for (i = 0; i < 5; i++) { - if (input[i + 1]) { - PHYDM_SSCANF(input[i + 2], DCMD_HEX, - &rf_var[i]); - input_idx++; - } + PHYDM_SSCANF(input[i + 2], DCMD_HEX, + &rf_var[i]); + input_idx++; } if (input_idx >= 1) { diff --git a/hal/phydm/phydm.c b/hal/phydm/phydm.c index 72324ba..0326b83 100644 --- a/hal/phydm/phydm.c +++ b/hal/phydm/phydm.c @@ -1544,8 +1544,7 @@ void phydm_supportability_en(void *dm_void, char input[][16], u32 *_used, u8 i; for (i = 0; i < 5; i++) { - if (input[i + 1]) - PHYDM_SSCANF(input[i + 1], DCMD_DECIMAL, &dm_value[i]); + PHYDM_SSCANF(input[i + 1], DCMD_DECIMAL, &dm_value[i]); } pre_support_ability = dm->support_ability; @@ -1912,8 +1911,7 @@ void phydm_pause_func_console(void *dm_void, char input[][16], u32 *_used, } for (i = 0; i < 10; i++) { - if (input[i + 1]) - PHYDM_SSCANF(input[i + 1], DCMD_HEX, &var1[i]); + PHYDM_SSCANF(input[i + 1], DCMD_HEX, &var1[i]); } func = (enum phydm_func_idx)var1[0]; diff --git a/hal/phydm/phydm_adaptivity.c b/hal/phydm/phydm_adaptivity.c index 0869036..1e0368e 100644 --- a/hal/phydm/phydm_adaptivity.c +++ b/hal/phydm/phydm_adaptivity.c @@ -362,10 +362,8 @@ void phydm_adaptivity_debug(void *dm_void, char input[][16], u32 *_used, s8 h2l_diff = 0; for (i = 0; i < 5; i++) { - if (input[i + 1]) { - PHYDM_SSCANF(input[i + 1], DCMD_HEX, &dm_value[i]); - input_idx++; - } + PHYDM_SSCANF(input[i + 1], DCMD_HEX, &dm_value[i]); + input_idx++; } if (strcmp(input[1], help) == 0) { PDM_SNPF(out_len, used, output + used, out_len - used, diff --git a/hal/phydm/phydm_api.c b/hal/phydm/phydm_api.c index f84279c..1dd8bb0 100644 --- a/hal/phydm/phydm_api.c +++ b/hal/phydm/phydm_api.c @@ -557,10 +557,8 @@ void phydm_config_trx_path_v1(void *dm_void, char input[][16], u32 *_used, return; for (i = 0; i < 5; i++) { - if (input[i + 1]) { - PHYDM_SSCANF(input[i + 1], DCMD_HEX, &val[i]); - input_idx++; - } + PHYDM_SSCANF(input[i + 1], DCMD_HEX, &val[i]); + input_idx++; } if (input_idx == 0) @@ -1850,10 +1848,8 @@ void phydm_nbi_debug(void *dm_void, char input[][16], u32 *_used, char *output, else idx_lmt = 5; for (i = 0; i < idx_lmt; i++) { - if (input[i + 1]) { - PHYDM_SSCANF(input[i + 1], DCMD_DECIMAL, &val[i]); - input_idx++; - } + PHYDM_SSCANF(input[i + 1], DCMD_DECIMAL, &val[i]); + input_idx++; } if (input_idx == 0) @@ -1942,10 +1938,8 @@ void phydm_csi_debug(void *dm_void, char input[][16], u32 *_used, char *output, idx_lmt = 5; for (i = 0; i < idx_lmt; i++) { - if (input[i + 1]) { - PHYDM_SSCANF(input[i + 1], DCMD_DECIMAL, &val[i]); - input_idx++; - } + PHYDM_SSCANF(input[i + 1], DCMD_DECIMAL, &val[i]); + input_idx++; } if (input_idx == 0) diff --git a/hal/phydm/phydm_ccx.c b/hal/phydm/phydm_ccx.c index 1f11046..58b4afc 100644 --- a/hal/phydm/phydm_ccx.c +++ b/hal/phydm/phydm_ccx.c @@ -292,8 +292,7 @@ void phydm_fahm_dbg(void *dm_void, char input[][16], u32 *_used, char *output, u32 i; for (i = 0; i < 2; i++) { - if (input[i + 1]) - PHYDM_SSCANF(input[i + 1], DCMD_DECIMAL, &var1[i]); + PHYDM_SSCANF(input[i + 1], DCMD_DECIMAL, &var1[i]); } if ((strcmp(input[1], help) == 0)) { @@ -1012,10 +1011,8 @@ void phydm_nhm_dbg(void *dm_void, char input[][16], u32 *_used, char *output, ccx->nhm_manual_ctrl = 1; for (i = 1; i < 7; i++) { - if (input[i + 1]) { - PHYDM_SSCANF(input[i + 1], DCMD_DECIMAL, - &var1[i]); - } + PHYDM_SSCANF(input[i + 1], DCMD_DECIMAL, + &var1[i]); } if (var1[0] == 1) { @@ -1468,8 +1465,7 @@ void phydm_clm_dbg(void *dm_void, char input[][16], u32 *_used, char *output, u32 i; for (i = 0; i < 4; i++) { - if (input[i + 1]) - PHYDM_SSCANF(input[i + 1], DCMD_DECIMAL, &var1[i]); + PHYDM_SSCANF(input[i + 1], DCMD_DECIMAL, &var1[i]); } if ((strcmp(input[1], help) == 0)) { diff --git a/hal/phydm/phydm_debug.c b/hal/phydm/phydm_debug.c index 5d63ea4..234bbf0 100644 --- a/hal/phydm/phydm_debug.c +++ b/hal/phydm/phydm_debug.c @@ -2864,10 +2864,8 @@ void phydm_set_txagc_dbg(void *dm_void, char input[][16], u32 *_used, u8 i = 0, input_idx = 0; for (i = 0; i < 5; i++) { - if (input[i + 1]) { - PHYDM_SSCANF(input[i + 1], DCMD_HEX, &var1[i]); - input_idx++; - } + PHYDM_SSCANF(input[i + 1], DCMD_HEX, &var1[i]); + input_idx++; } if ((strcmp(input[1], help) == 0)) { @@ -2906,8 +2904,7 @@ void phydm_debug_trace(void *dm_void, char input[][16], u32 *_used, u8 i; for (i = 0; i < 5; i++) { - if (input[i + 1]) - PHYDM_SSCANF(input[i + 1], DCMD_DECIMAL, &val[i]); + PHYDM_SSCANF(input[i + 1], DCMD_DECIMAL, &val[i]); } comp = dm->debug_components; pre_debug_components = dm->debug_components; @@ -3063,10 +3060,8 @@ void phydm_fw_debug_trace(void *dm_void, char input[][16], u32 *_used, u32 comp = 0; for (i = 0; i < 5; i++) { - if (input[i + 1]) { - PHYDM_SSCANF(input[i + 1], DCMD_DECIMAL, &val[i]); - input_idx++; - } + PHYDM_SSCANF(input[i + 1], DCMD_DECIMAL, &val[i]); + input_idx++; } if (input_idx == 0) @@ -3379,8 +3374,7 @@ void phydm_dump_reg(void *dm_void, char input[][16], u32 *_used, char *output, u32 out_len = *_out_len; u32 addr = 0; - if (input[1]) - PHYDM_SSCANF(input[1], DCMD_DECIMAL, &var1[0]); + PHYDM_SSCANF(input[1], DCMD_DECIMAL, &var1[0]); if ((strcmp(input[1], help) == 0)) { #ifdef PHYDM_IC_JGR3_SERIES_SUPPORT @@ -3563,8 +3557,7 @@ void phydm_per_tone_evm(void *dm_void, char input[][16], u32 *_used, } for (i = 0; i < 4; i++) { - if (input[i + 1]) - PHYDM_SSCANF(input[i + 1], DCMD_DECIMAL, &var1[i]); + PHYDM_SSCANF(input[i + 1], DCMD_DECIMAL, &var1[i]); } avg_num = var1[0]; @@ -3817,10 +3810,8 @@ void phydm_ext_rf_element_ctrl(void *dm_void, char input[][16], u32 *_used, u8 i = 0, input_idx = 0; for (i = 0; i < 5; i++) { - if (input[i + 1]) { - PHYDM_SSCANF(input[i + 1], DCMD_DECIMAL, &val[i]); - input_idx++; - } + PHYDM_SSCANF(input[i + 1], DCMD_DECIMAL, &val[i]); + input_idx++; } if (input_idx == 0) @@ -4243,8 +4234,7 @@ void phydm_cmd_parser(struct dm_struct *dm, char input[][MAX_ARGV], break; case PHYDM_DIS_HTSTF_CONTROL: { - if (input[1]) - PHYDM_SSCANF(input[1], DCMD_DECIMAL, &var1[0]); + PHYDM_SSCANF(input[1], DCMD_DECIMAL, &var1[0]); if (var1[0] == 1) { /* setting being false is for debug */ diff --git a/hal/phydm/phydm_psd.c b/hal/phydm/phydm_psd.c index 458677b..9261764 100644 --- a/hal/phydm/phydm_psd.c +++ b/hal/phydm/phydm_psd.c @@ -411,8 +411,7 @@ void phydm_psd_debug(void *dm_void, char input[][16], u32 *_used, if (var1[0] == 0) { for (i = 1; i < 10; i++) { - if (input[i + 1]) - PHYDM_SSCANF(input[i + 1], DCMD_DECIMAL, + PHYDM_SSCANF(input[i + 1], DCMD_DECIMAL, &var1[i]); } PDM_SNPF(out_len, used, output + used, out_len - used, diff --git a/hal/phydm/phydm_rainfo.c b/hal/phydm/phydm_rainfo.c index 077585d..cc5dd25 100644 --- a/hal/phydm/phydm_rainfo.c +++ b/hal/phydm/phydm_rainfo.c @@ -125,10 +125,8 @@ void phydm_h2C_debug(void *dm_void, char input[][16], u32 *_used, u8 phydm_h2c_id = 0; for (i = 0; i < 8; i++) { - if (input[i + 1]) { - PHYDM_SSCANF(input[i + 1], DCMD_HEX, &dm_value[i]); - input_idx++; - } + PHYDM_SSCANF(input[i + 1], DCMD_HEX, &dm_value[i]); + input_idx++; } if (input_idx == 0) @@ -193,8 +191,7 @@ void phydm_ra_debug(void *dm_void, char input[][16], u32 *_used, char *output, u8 i = 0; for (i = 0; i < 5; i++) { - if (input[i + 1]) - PHYDM_SSCANF(input[i + 1], DCMD_DECIMAL, &var[i]); + PHYDM_SSCANF(input[i + 1], DCMD_DECIMAL, &var[i]); } if ((strcmp(input[1], help) == 0)) { diff --git a/hal/phydm/phydm_smt_ant.c b/hal/phydm/phydm_smt_ant.c index 8e805b3..845e34b 100644 --- a/hal/phydm/phydm_smt_ant.c +++ b/hal/phydm/phydm_smt_ant.c @@ -319,8 +319,7 @@ void phydm_cumitek_smt_ant_debug( } else if (dm_value[0] == 2) { /*@fix tx pattern*/ for (i = 1; i < 4; i++) { - if (input[i + 1]) - PHYDM_SSCANF(input[i + 1], DCMD_DECIMAL, &dm_value[i]); + PHYDM_SSCANF(input[i + 1], DCMD_DECIMAL, &dm_value[i]); } PDM_SNPF(out_len, used, output + used, out_len - used, @@ -333,8 +332,7 @@ void phydm_cumitek_smt_ant_debug( u8 table_path_b[8] = {0}; for (i = 1; i < 4; i++) { - if (input[i + 1]) - PHYDM_SSCANF(input[i + 1], DCMD_HEX, &dm_value[i]); + PHYDM_SSCANF(input[i + 1], DCMD_HEX, &dm_value[i]); } PDM_SNPF(out_len, used, output + used, out_len - used, diff --git a/os_dep/linux/ioctl_cfg80211.c b/os_dep/linux/ioctl_cfg80211.c index 1f9be57..17473cd 100644 --- a/os_dep/linux/ioctl_cfg80211.c +++ b/os_dep/linux/ioctl_cfg80211.c @@ -2958,8 +2958,7 @@ static int cfg80211_rtw_scan(struct wiphy *wiphy #endif #ifdef CONFIG_P2P if (pwdinfo->driver_interface == DRIVER_CFG80211) { - if (ssids->ssid != NULL - && _rtw_memcmp(ssids->ssid, "DIRECT-", 7) + if (_rtw_memcmp(ssids->ssid, "DIRECT-", 7) && rtw_get_p2p_ie((u8 *)request->ie, request->ie_len, NULL, NULL) ) { if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) @@ -9814,10 +9813,8 @@ void rtw_cfg80211_external_auth_status(struct wiphy *wiphy, struct net_device *d psta->state |= WIFI_FW_AUTH_SUCCESS; psta->expire_to = padapter->stapriv.assoc_to; - if (params->pmkid != NULL) { - /* RTW_INFO_DUMP("PMKID:", params->pmkid, PMKID_LEN); */ - _rtw_set_pmksa(dev, params->bssid, params->pmkid); - } + /* RTW_INFO_DUMP("PMKID:", params->pmkid, PMKID_LEN); */ + _rtw_set_pmksa(dev, params->bssid, params->pmkid); _enter_critical_bh(&psta->lock, &irqL); if ((psta->auth_len != 0) && (psta->pauth_frame != NULL)) {