staging: rtl8188eu: use is_multicast_ether_addr in rtw_security.c
PATCH v3 1/5 staging: rtl8188eu: use is_multicast_ether_addr in rtw_security.c
Use is_multicast_ether_addr instead of custom IS_MCAST in core/rtw_security.c. In all uses the address array is properly aligned.
---
v2: checked that in all uses of is_multicast_ether_addr
the address array/memory is properly aligned and updated the commit messages
v3: added "Reviewed-by: Dan Carpenter <[email protected]>"
drivers/staging/rtl8188eu/core/rtw_security.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/staging/rtl8188eu/core/rtw_security.c +4 -4
@@ -608,7 +608,7 @@ u32 rtw_tkip_encrypt(struct adapter *padapter, u8 *pxmitframe)if (stainfo !=NULL ) {RT_TRACE (_module_rtl871x_security_c_, _drv_err_, ("%s: stainfo!= NULL!!!\n" , __func__)); -if (IS_MCAST (pattrib->ra)) +if (is_multicast_ether_addr (pattrib->ra)) prwskey = psecuritypriv->dot118021XGrpKey[psecuritypriv->dot118021XGrpKeyid].skey;else prwskey = &stainfo->dot118021x_UncstKey.skey[0 ];
@@ -678,7 +678,7 @@ u32 rtw_tkip_decrypt(struct adapter *padapter, u8 *precvframe)if (prxattrib->encrypt == _TKIP_) { stainfo =rtw_get_stainfo (&padapter->stapriv, &prxattrib->ta[0 ]);if (stainfo) { -if (IS_MCAST (prxattrib->ra)) { +if (is_multicast_ether_addr (prxattrib->ra)) {if (!psecuritypriv->binstallGrpkey) { res = _FAIL;DBG_88E ("%s:rx bc/mc packets, but didn't install group key!!!!!!!!!!\n" , __func__);
@@ -1250,7 +1250,7 @@ u32 rtw_aes_encrypt(struct adapter *padapter, u8 *pxmitframe)if (stainfo) {RT_TRACE (_module_rtl871x_security_c_, _drv_err_, ("%s: stainfo!= NULL!!!\n" , __func__)); -if (IS_MCAST (pattrib->ra)) +if (is_multicast_ether_addr (pattrib->ra)) prwskey = psecuritypriv->dot118021XGrpKey[psecuritypriv->dot118021XGrpKeyid].skey;else prwskey = &stainfo->dot118021x_UncstKey.skey[0 ];
@@ -1296,7 +1296,7 @@ u32 rtw_aes_decrypt(struct adapter *padapter, u8 *precvframe)struct security_priv *psecuritypriv = &padapter->securitypriv;char iv[8 ], icv[8 ]; -if (IS_MCAST (prxattrib->ra)) { +if (is_multicast_ether_addr (prxattrib->ra)) {/* in concurrent we should use sw descrypt in group key, so we remove this message */ if (!psecuritypriv->binstallGrpkey) { res = _FAIL;
Signature · 1 line
2.18.0
PATCH v3 2/5 staging: rtl8188eu: use is_multicast_ether_addr in rtw_recv.c
Use is_multicast_ether_addr instead of custom IS_MCAST in core/rtw_recv.c. In all uses the address array/memory is properly aligned.
--- drivers/staging/rtl8188eu/core/rtw_recv.c | 35 ++++++++++++----------- 1 file changed, 18 insertions(+), 17 deletions(-)
drivers/staging/rtl8188eu/core/rtw_recv.c +18 -17
@@ -233,7 +233,7 @@ static int recvframe_chkmic(struct adapter *adapter,/* calculate mic code */ if (stainfo) { -if (IS_MCAST (prxattrib->ra)) { +if (is_multicast_ether_addr (prxattrib->ra)) {if (!psecuritypriv) { res = _FAIL; RT_TRACE(_module_rtl871x_recv_c_, _drv_err_,
@@ -321,11 +321,11 @@ static int recvframe_chkmic(struct adapter *adapter,/* double check key_index for some timing issue , */ /* cannot compare with psecuritypriv->dot118021XGrpKeyid also cause timing issue */ -if ((IS_MCAST (prxattrib->ra) == true) && (prxattrib->key_index != pmlmeinfo->key_index)) +if (is_multicast_ether_addr (prxattrib->ra) && prxattrib->key_index != pmlmeinfo->key_index) brpt_micerror = false;if ((prxattrib->bdecrypted) && (brpt_micerror)) { -rtw_handle_tkip_mic_err (adapter, (u8 )IS_MCAST (prxattrib->ra)); +rtw_handle_tkip_mic_err (adapter, (u8 )is_multicast_ether_addr (prxattrib->ra));RT_TRACE (_module_rtl871x_recv_c_, _drv_err_, (" mic error :prxattrib->bdecrypted=%d " , prxattrib->bdecrypted));DBG_88E (" mic error :prxattrib->bdecrypted=%d\n" , prxattrib->bdecrypted); }else {
@@ -335,7 +335,7 @@ static int recvframe_chkmic(struct adapter *adapter, res = _FAIL; }else {/* mic checked ok */ -if ((!psecuritypriv->bcheck_grpkey) && (IS_MCAST (prxattrib->ra))) { +if (!psecuritypriv->bcheck_grpkey &&is_multicast_ether_addr (prxattrib->ra)) { psecuritypriv->bcheck_grpkey = true;RT_TRACE (_module_rtl871x_recv_c_, _drv_err_, ("psecuritypriv->bcheck_grpkey = true" )); }
@@ -648,7 +648,7 @@ int sta2sta_data_frame(struct adapter *adapter, struct recv_frame *precv_frame,u8 *mybssid =get_bssid (pmlmepriv);u8 *myhwaddr =myid (&adapter->eeprompriv);u8 *sta_addr =NULL ; -int bmcast =IS_MCAST (pattrib->dst); +bool mcast =is_multicast_ether_addr (pattrib->dst);if ((check_fwstate (pmlmepriv,WIFI_ADHOC_STATE ) == true) || (check_fwstate (pmlmepriv,WIFI_ADHOC_MASTER_STATE ) == true)) {
@@ -659,7 +659,7 @@ int sta2sta_data_frame(struct adapter *adapter, struct recv_frame *precv_frame, goto exit; } -if ((memcmp (myhwaddr, pattrib->dst,ETH_ALEN )) && (!bmcast)) { +if (memcmp (myhwaddr, pattrib->dst,ETH_ALEN ) && !mcast) { ret = _FAIL; goto exit; }
@@ -681,9 +681,9 @@ int sta2sta_data_frame(struct adapter *adapter, struct recv_frame *precv_frame, } sta_addr = pattrib->bssid; }else if (check_fwstate (pmlmepriv,WIFI_AP_STATE )) { -if (bmcast) { +if (mcast) {/* For AP mode, if DA == MCAST, then BSSID should be also MCAST */ -if (!IS_MCAST (pattrib->bssid)) { +if (!is_multicast_ether_addr (pattrib->bssid)) { ret = _FAIL; goto exit; }
@@ -700,7 +700,7 @@ int sta2sta_data_frame(struct adapter *adapter, struct recv_frame *precv_frame, ret = _FAIL; } -if (bmcast) +if (mcast) *psta =rtw_get_bcmc_stainfo (adapter);else *psta =rtw_get_stainfo (pstapriv, sta_addr);/* get ap_info */
@@ -727,7 +727,7 @@ static int ap2sta_data_frame(struct mlme_priv *pmlmepriv = &adapter->mlmepriv;u8 *mybssid =get_bssid (pmlmepriv);u8 *myhwaddr =myid (&adapter->eeprompriv); -int bmcast =IS_MCAST (pattrib->dst); +bool mcast =is_multicast_ether_addr (pattrib->dst); if ((check_fwstate(pmlmepriv, WIFI_STATION_STATE) == true) && (check_fwstate(pmlmepriv, _FW_LINKED) == true ||
@@ -740,7 +740,7 @@ static int ap2sta_data_frame( }/* da should be for me */ -if ((memcmp (myhwaddr, pattrib->dst,ETH_ALEN )) && (!bmcast)) { +if (memcmp (myhwaddr, pattrib->dst,ETH_ALEN ) && !mcast) {RT_TRACE (_module_rtl871x_recv_c_, _drv_info_, (" %s: compare DA fail; DA=%pM\n" , __func__, (pattrib->dst))); ret = _FAIL;
@@ -755,7 +755,7 @@ static int ap2sta_data_frame( (" %s: compare BSSID fail ; BSSID=%pM\n", __func__, (pattrib->bssid)));RT_TRACE (_module_rtl871x_recv_c_, _drv_info_, ("mybssid=%pM\n" , (mybssid))); -if (!bmcast) { +if (!mcast) {DBG_88E ("issue_deauth to the nonassociated ap=%pM for the reason(7)\n" , (pattrib->bssid));issue_deauth (adapter, pattrib->bssid,WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA ); }
@@ -764,7 +764,7 @@ static int ap2sta_data_frame( goto exit; } -if (bmcast) +if (mcast) *psta =rtw_get_bcmc_stainfo (adapter);else *psta =rtw_get_stainfo (pstapriv, pattrib->bssid);/* get ap_info */
@@ -789,7 +789,7 @@ static int ap2sta_data_frame( ret =RTW_RX_HANDLED ; goto exit; }else { -if (!memcmp (myhwaddr, pattrib->dst,ETH_ALEN ) && (!bmcast)) { +if (!memcmp (myhwaddr, pattrib->dst,ETH_ALEN ) && !mcast) { *psta =rtw_get_stainfo (pstapriv, pattrib->bssid);/* get sta_info */ if (*psta ==NULL ) {DBG_88E ("issue_deauth to the ap =%pM for the reason(7)\n" , (pattrib->bssid));
@@ -1129,9 +1129,9 @@ static int validate_recv_data_frame(struct adapter *adapter,if (pattrib->privacy) {RT_TRACE (_module_rtl871x_recv_c_, _drv_info_, ("%s:pattrib->privacy=%x\n" , __func__, pattrib->privacy)); -RT_TRACE (_module_rtl871x_recv_c_, _drv_info_, ("\n ^^^^^^^^^^^IS_MCAST(pattrib->ra(0x%02x))=%d^^^^^^^^^^^^^^^6\n" , pattrib->ra[0 ],IS_MCAST (pattrib->ra))); +RT_TRACE (_module_rtl871x_recv_c_, _drv_info_, ("\n ^^^^^^^^^^^is_multicast_ether_addr(pattrib->ra(0x%02x))=%d^^^^^^^^^^^^^^^6\n" , pattrib->ra[0 ],is_multicast_ether_addr (pattrib->ra))); -GET_ENCRY_ALGO (psecuritypriv, psta, pattrib->encrypt,IS_MCAST (pattrib->ra)); +GET_ENCRY_ALGO (psecuritypriv, psta, pattrib->encrypt,is_multicast_ether_addr (pattrib->ra));RT_TRACE (_module_rtl871x_recv_c_, _drv_info_, ("\n pattrib->encrypt=%d\n" , pattrib->encrypt));
@@ -1971,7 +1971,8 @@ static int recv_func(struct adapter *padapter, struct recv_frame *rframe)if (ret == _SUCCESS) {/* check if need to enqueue into uc_swdec_pending_queue*/ if (check_fwstate (mlmepriv,WIFI_STATION_STATE ) && - !IS_MCAST (prxattrib->ra) && prxattrib->encrypt >0 && + !is_multicast_ether_addr (prxattrib->ra) && + prxattrib->encrypt >0 && prxattrib->bdecrypted ==0 && !is_wep_enc (psecuritypriv->dot11PrivacyAlgrthm) && !psecuritypriv->busetkipkey) {
Signature · 1 line
2.18.0
PATCH v3 3/5 staging: rtl8188eu: use is_multicast_ether_addr in rtw_xmit.c
In reply to Michael StraubeUse is_multicast_ether_addr instead of custom IS_MCAST in core/rtw_xmit.c. In all uses the address array is properly aligned.
--- drivers/staging/rtl8188eu/core/rtw_xmit.c | 35 +++++++++++------------ 1 file changed, 16 insertions(+), 19 deletions(-)
drivers/staging/rtl8188eu/core/rtw_xmit.c +16 -19
@@ -399,7 +399,7 @@ static s32 update_attrib(struct adapter *padapter, struct sk_buff *pkt, struct pstruct sta_info *psta =NULL ;struct ethhdr etherhdr; -int bmcast; +bool mcast;struct sta_priv *pstapriv = &padapter->stapriv;struct security_priv *psecuritypriv = &padapter->securitypriv;struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
@@ -460,10 +460,10 @@ static s32 update_attrib(struct adapter *padapter, struct sk_buff *pkt, struct pif ((pattrib->ether_type ==ETH_P_ARP ) || (pattrib->ether_type ==ETH_P_PAE ) || (pattrib->dhcp_pkt ==1 ))rtw_lps_ctrl_wk_cmd (padapter,LPS_CTRL_SPECIAL_PACKET ,1 ); - bmcast =IS_MCAST (pattrib->ra); + mcast =is_multicast_ether_addr (pattrib->ra);/* get sta_info */ -if (bmcast) { +if (mcast) { psta =rtw_get_bcmc_stainfo (padapter); }else { psta =rtw_get_stainfo (pstapriv, pattrib->ra);
@@ -517,7 +517,7 @@ static s32 update_attrib(struct adapter *padapter, struct sk_buff *pkt, struct p goto exit; } }else { -GET_ENCRY_ALGO (psecuritypriv, psta, pattrib->encrypt, bmcast); +GET_ENCRY_ALGO (psecuritypriv, psta, pattrib->encrypt, mcast);switch (psecuritypriv->dot11AuthAlgrthm) {case dot11AuthAlgrthm_Open:
@@ -526,7 +526,7 @@ static s32 update_attrib(struct adapter *padapter, struct sk_buff *pkt, struct p pattrib->key_idx = (u8 )psecuritypriv->dot11PrivacyKeyIndex;break ;case dot11AuthAlgrthm_8021X: -if (bmcast) +if (mcast) pattrib->key_idx = (u8 )psecuritypriv->dot118021XGrpKeyid;else pattrib->key_idx =0 ;
@@ -596,7 +596,6 @@ static s32 xmitframe_addmic(struct adapter *padapter, struct xmit_frame *pxmitfrstruct xmit_priv *pxmitpriv = &padapter->xmitpriv;u8 priority[4 ] = {0x0 ,0x0 ,0x0 ,0x0 };u8 hw_hdr_offset =0 ; -int bmcst =IS_MCAST (pattrib->ra);if (pattrib->psta) stainfo = pattrib->psta;
@@ -614,7 +613,7 @@ static s32 xmitframe_addmic(struct adapter *padapter, struct xmit_frame *pxmitfr pframe = pxmitframe->buf_addr + hw_hdr_offset; -if (bmcst) { +if (is_multicast_ether_addr (pattrib->ra)) {if (!memcmp (psecuritypriv->dot118021XGrptxmickey[psecuritypriv->dot118021XGrpKeyid].skey, null_key,16 ))return _FAIL;/* start to calculate the mic code */
@@ -743,12 +742,10 @@ s32 rtw_make_wlanhdr(struct adapter *padapter, u8 *hdr, struct pkt_attrib *pattrstruct sta_info *psta; -int bmcst =IS_MCAST (pattrib->ra); -if (pattrib->psta) { psta = pattrib->psta; }else { -if (bmcst) +if (is_multicast_ether_addr (pattrib->ra)) psta =rtw_get_bcmc_stainfo (padapter);else psta =rtw_get_stainfo (&padapter->stapriv, pattrib->ra);
@@ -914,7 +911,7 @@ s32 rtw_xmitframe_coalesce(struct adapter *padapter, struct sk_buff *pkt, structstruct xmit_priv *pxmitpriv = &padapter->xmitpriv;struct pkt_attrib *pattrib = &pxmitframe->attrib;u8 *pbuf_start; -s32 bmcst =IS_MCAST (pattrib->ra); +bool mcast =is_multicast_ether_addr (pattrib->ra);s32 res = _SUCCESS;size_t remainder = pkt->len -ETH_HLEN ;
@@ -964,13 +961,13 @@ s32 rtw_xmitframe_coalesce(struct adapter *padapter, struct sk_buff *pkt, structWEP_IV (pattrib->iv, psta->dot11txpn, pattrib->key_idx);break ;case _TKIP_: -if (bmcst) +if (mcast)TKIP_IV (pattrib->iv, psta->dot11txpn, pattrib->key_idx);else TKIP_IV (pattrib->iv, psta->dot11txpn,0 );break ;case _AES_: -if (bmcst) +if (mcast)AES_IV (pattrib->iv, psta->dot11txpn, pattrib->key_idx);else AES_IV (pattrib->iv, psta->dot11txpn,0 );
@@ -997,7 +994,7 @@ s32 rtw_xmitframe_coalesce(struct adapter *padapter, struct sk_buff *pkt, structif ((pattrib->icv_len >0 ) && (pattrib->bswenc)) mpdu_len -= pattrib->icv_len; - mem_sz =min_t (size_t, bmcst ? pattrib->pktlen : mpdu_len, remainder); + mem_sz =min_t (size_t, mcast ? pattrib->pktlen : mpdu_len, remainder);skb_copy_bits (pkt, pkt->len - remainder, pframe, mem_sz); remainder -= mem_sz;
@@ -1010,7 +1007,7 @@ s32 rtw_xmitframe_coalesce(struct adapter *padapter, struct sk_buff *pkt, struct frg_inx++; -if (bmcst || remainder ==0 ) { +if (mcast || remainder ==0 ) { pattrib->nr_frags = frg_inx; pattrib->last_txcmdsz = pattrib->hdrlen + pattrib->iv_len + ((pattrib->nr_frags == 1) ? llc_sz : 0) +
@@ -1041,7 +1038,7 @@ s32 rtw_xmitframe_coalesce(struct adapter *padapter, struct sk_buff *pkt, structxmitframe_swencrypt (padapter, pxmitframe); -if (!bmcst) +if (!mcast)update_attrib_vcs_info (padapter, pxmitframe);else pattrib->vcs_mode =NONE_VCS ;
@@ -1632,7 +1629,7 @@ int xmitframe_enqueue_for_sleeping_sta(struct adapter *padapter, struct xmit_frastruct sta_priv *pstapriv = &padapter->stapriv;struct pkt_attrib *pattrib = &pxmitframe->attrib;struct mlme_priv *pmlmepriv = &padapter->mlmepriv; -int bmcst =IS_MCAST (pattrib->ra); +bool mcast =is_multicast_ether_addr (pattrib->ra);if (check_fwstate (pmlmepriv,WIFI_AP_STATE ) == false)return ret;
@@ -1646,12 +1643,12 @@ int xmitframe_enqueue_for_sleeping_sta(struct adapter *padapter, struct xmit_frareturn ret;if (pattrib->triggered ==1 ) { -if (bmcst) +if (mcast) pattrib->qsel =0x11 ;/* HIQ */ return ret; } -if (bmcst) { +if (mcast) {spin_lock_bh (&psta->sleep_q.lock);if (pstapriv->sta_dz_bitmap) {/* if any one sta is in ps mode */
Signature · 1 line
2.18.0
PATCH v3 4/5 staging: rtl8188eu: remove unused IS_MCAST
In reply to Michael StraubeRemove the now unused IS_MCAST.
--- drivers/staging/rtl8188eu/include/wifi.h | 8 -------- 1 file changed, 8 deletions(-)
drivers/staging/rtl8188eu/include/wifi.h +0 -8
@@ -257,14 +257,6 @@ enum WIFI_REG_DOMAIN {#define GetAddr4Ptr (pbuf) ((unsigned char *)((size_t)(pbuf) + 24)) -static inline int IS_MCAST (unsigned char *da) -{ -if ((*da) &0x01 ) -return true; -else -return false; -} -static inline unsigned char *get_da (unsigned char *pframe) {unsigned char *da;
Signature · 1 line
2.18.0
PATCH v3 5/5 staging: rtl8188eu: use phydm_reg.h from rtlwifi
In reply to Michael StraubeUse rtlwifi/phydm/phydm_reg.h instead of odm_reg.h and remove the now unused odm_reg.h.
All defines from odm_reg.h are defined with the same values in rtlwifi/phydm/phydm_reg.h.
--- .../staging/rtl8188eu/include/odm_precomp.h | 2 +- drivers/staging/rtl8188eu/include/odm_reg.h | 106 ------------------ 2 files changed, 1 insertion(+), 107 deletions(-) delete mode 100644 drivers/staging/rtl8188eu/include/odm_reg.h
drivers/staging/rtl8188eu/include/odm_precomp.h +1 -1
@@ -29,7 +29,7 @@#include "hal8188e_rate_adaptive.h" /* for RA,Power training */ #include "rtl8188e_hal.h" -#include "odm_reg.h" +#include "../../rtlwifi/phydm/phydm_reg.h" #include "odm_rtl8188e.h"
drivers/staging/rtl8188eu/include/odm_reg.h deleted +0 -106
106 lines not on this page · raw message
Signature · 1 line
2.18.0
No no... I only gave it a Reviewed-by tag because I didn't want you to resend again... :P
regards,
dan carpenter
Quoted 2 lines · Dan Carpenter
No no... I only gave it a Reviewed-by tag because I didn't want you to resend again... :P
Ah, sorry. So I shouldn't have added the tag? Should I remove it again? I guess not..
How are those tags (reviewed, acked, etc.) handled normaly? I'm a bit confused now. ;)
Michael
Quoted 8 lines · Michael Straube
Quoted 2 lines · Dan Carpenter
No no... I only gave it a Reviewed-by tag because I didn't want you to resend again... :P
Ah, sorry. So I shouldn't have added the tag? Should I remove it again? I guess not..
How are those tags (reviewed, acked, etc.) handled normaly? I'm a bit confused now. ;)
Greg adds it.
regards,
dan carpenter