staging: r8188eu: simplify the checks for zero address
authorMartin Kaiser <martin@kaiser.cx>
Sat, 26 Nov 2022 15:42:52 +0000 (16:42 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 5 Dec 2022 12:26:13 +0000 (13:26 +0100)
In function ap2sta_data_frame, we can use is_zero_ether_addr to check for
all-zero ethernet addresses. Both pattrib->bssid and mybssid are 16-bit
aligned.

Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20221126154253.178275-5-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/r8188eu/core/rtw_recv.c

index 5b0a66aebff196152b2f414114aa60028ce05f34..631c500dda4279ffb19f80d95490e4e28be256fb 100644 (file)
@@ -779,9 +779,8 @@ static int ap2sta_data_frame(
                }
 
                /*  check BSSID */
-               if (!memcmp(pattrib->bssid, "\x0\x0\x0\x0\x0\x0", ETH_ALEN) ||
-                   !memcmp(mybssid, "\x0\x0\x0\x0\x0\x0", ETH_ALEN) ||
-                    (memcmp(pattrib->bssid, mybssid, ETH_ALEN))) {
+               if (is_zero_ether_addr(pattrib->bssid) || is_zero_ether_addr(mybssid) ||
+                   (memcmp(pattrib->bssid, mybssid, ETH_ALEN))) {
                        if (!bmcast)
                                issue_deauth(adapter, pattrib->bssid, WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA);