brcmsmac: improve readability on addresses copy
authorÍñigo Huguet <ihuguet@redhat.com>
Tue, 11 May 2021 07:02:58 +0000 (09:02 +0200)
committerKalle Valo <kvalo@codeaurora.org>
Tue, 15 Jun 2021 10:40:15 +0000 (13:40 +0300)
A static analyzer identified as a potential bug the copy of
12 bytes from a 6 bytes array to a 6 bytes array. Both
arrays are 6 bytes addresses.

Although not being a real bug, it is not immediately clear
why is done this way: next 6 bytes address, contiguous to
the first one, must also be copied to next contiguous 6 bytes
address of the destination.

Copying each one separately will make both static analyzers
and reviewers happier.

Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20210511070257.7843-1-ihuguet@redhat.com
drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c

index 763e0ec583d78ba5de6a88759ff8ed6a4c3c5cf7..26de1bd7fee9005c84415f822c900a3318648468 100644 (file)
@@ -6607,7 +6607,8 @@ brcms_c_d11hdrs_mac80211(struct brcms_c_info *wlc, struct ieee80211_hw *hw,
                        rts->frame_control = cpu_to_le16(IEEE80211_FTYPE_CTL |
                                                         IEEE80211_STYPE_RTS);
 
-                       memcpy(&rts->ra, &h->addr1, 2 * ETH_ALEN);
+                       memcpy(&rts->ra, &h->addr1, ETH_ALEN);
+                       memcpy(&rts->ta, &h->addr2, ETH_ALEN);
                }
 
                /* mainrate