staging: r8188eu: use ether_addr_equal in OnAction

Message ID 20221031205140.124682-1-martin@kaiser.cx
State New
Headers
Series staging: r8188eu: use ether_addr_equal in OnAction |

Commit Message

Martin Kaiser Oct. 31, 2022, 8:51 p.m. UTC
  Use ether_addr_equal to compare two mac addresses in OnAction.

Both struct ieee80211_mgmt and struct eeprom_priv's mac_addr component
are 2-byte aligned.

Suggested-by: Joe Perches <joe@perches.com>
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 drivers/staging/r8188eu/core/rtw_mlme_ext.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Philipp Hortmann Oct. 31, 2022, 10 p.m. UTC | #1
On 10/31/22 21:51, Martin Kaiser wrote:
> Use ether_addr_equal to compare two mac addresses in OnAction.
> 
> Both struct ieee80211_mgmt and struct eeprom_priv's mac_addr component
> are 2-byte aligned.
> 
> Suggested-by: Joe Perches <joe@perches.com>
> Signed-off-by: Martin Kaiser <martin@kaiser.cx>
> ---
>   drivers/staging/r8188eu/core/rtw_mlme_ext.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/r8188eu/core/rtw_mlme_ext.c
> index e985fc5fc575..6679d4037d6b 100644
> --- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c
> +++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c
> @@ -3823,7 +3823,7 @@ static void OnAction(struct adapter *padapter, struct recv_frame *precv_frame)
>   {
>   	struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)precv_frame->rx_data;
>   
> -	if (memcmp(myid(&padapter->eeprompriv), mgmt->da, ETH_ALEN))
> +	if (!ether_addr_equal(myid(&padapter->eeprompriv), mgmt->da))
>   		return;
>   
>   	switch (mgmt->u.action.category) {

Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150
  

Patch

diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/r8188eu/core/rtw_mlme_ext.c
index e985fc5fc575..6679d4037d6b 100644
--- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c
+++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c
@@ -3823,7 +3823,7 @@  static void OnAction(struct adapter *padapter, struct recv_frame *precv_frame)
 {
 	struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)precv_frame->rx_data;
 
-	if (memcmp(myid(&padapter->eeprompriv), mgmt->da, ETH_ALEN))
+	if (!ether_addr_equal(myid(&padapter->eeprompriv), mgmt->da))
 		return;
 
 	switch (mgmt->u.action.category) {