summaryrefslogtreecommitdiff
path: root/drivers/staging/wlan-ng
diff options
context:
space:
mode:
authorMaciek Borzecki <maciek.borzecki@gmail.com>2015-10-03 16:01:36 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-10-04 08:27:48 +0100
commita305cf316239073eab9da9ba22266bb698f5c3f7 (patch)
tree84fb8c30a578017e354b4de400b68c5dbfabfade /drivers/staging/wlan-ng
parent866a2c247fb9eebe91a11cafd38fd4dd8b25efed (diff)
staging: wlan-ng: prism2sta: replace memcmp with ether_addr_equal
Replace memcmp() with ether_addr_equal(). In every location where the replacement was done, the addresses accessed are __aligned(2). Structures accessed either stack or heap allocated, no direct memory casts to possibly unaligned structs are used. Involved structures: typedef struct hfa384x_authenticateStation_data { u8 address[ETH_ALEN]; /* 0 offset */ ... } __packed hfa384x_authenticateStation_data_t; struct prism2sta_authlist { unsigned int cnt; u8 addr[WLAN_AUTH_MAX][ETH_ALEN]; /* 4 bytes offset, addresses start at u16 boundary */ u8 assoc[WLAN_AUTH_MAX]; }; struct prism2sta_accesslist { unsigned int modify; unsigned int cnt; u8 addr[WLAN_ACCESS_MAX][ETH_ALEN]; /* 8 bytes offset, multiple of u16 */ ... u8 addr1[WLAN_ACCESS_MAX][ETH_ALEN]; /* starts at u32 boundary, struct not packed */ }; typedef struct hfa384x_AssocStatus { u16 assocstatus; u8 sta_addr[ETH_ALEN]; /* 2 bytes offset, struct is packed */ u8 old_ap_addr[ETH_ALEN]; /* 8 bytes offset */ ... } __packed hfa384x_AssocStatus_t; The patch resolves the following checkpatch warnings: WARNING: Prefer ether_addr_equal() or ether_addr_equal_unaligned() over memcmp() Signed-off-by: Maciek Borzecki <maciek.borzecki@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/wlan-ng')
-rw-r--r--drivers/staging/wlan-ng/prism2sta.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/staging/wlan-ng/prism2sta.c b/drivers/staging/wlan-ng/prism2sta.c
index bd979863e6a9..c57f48a1d8df 100644
--- a/drivers/staging/wlan-ng/prism2sta.c
+++ b/drivers/staging/wlan-ng/prism2sta.c
@@ -1490,7 +1490,7 @@ static void prism2sta_inf_assocstatus(wlandevice_t *wlandev,
*/
for (i = 0; i < hw->authlist.cnt; i++)
- if (memcmp(rec.sta_addr, hw->authlist.addr[i], ETH_ALEN) == 0)
+ if (ether_addr_equal(rec.sta_addr, hw->authlist.addr[i]))
break;
if (i >= hw->authlist.cnt) {
@@ -1572,8 +1572,8 @@ static void prism2sta_inf_authreq_defer(wlandevice_t *wlandev,
*/
for (i = 0; i < hw->authlist.cnt; i++)
- if (memcmp(rec.address, hw->authlist.addr[i],
- ETH_ALEN) == 0) {
+ if (ether_addr_equal(rec.address,
+ hw->authlist.addr[i])) {
rec.status = P80211ENUM_status_successful;
break;
}
@@ -1610,7 +1610,7 @@ static void prism2sta_inf_authreq_defer(wlandevice_t *wlandev,
}
for (i = 0; i < cnt; i++, addr += ETH_ALEN)
- if (memcmp(rec.address, addr, ETH_ALEN) == 0) {
+ if (ether_addr_equal(rec.address, addr)) {
rec.status = P80211ENUM_status_successful;
break;
}
@@ -1640,7 +1640,7 @@ static void prism2sta_inf_authreq_defer(wlandevice_t *wlandev,
rec.status = P80211ENUM_status_successful;
for (i = 0; i < cnt; i++, addr += ETH_ALEN)
- if (memcmp(rec.address, addr, ETH_ALEN) == 0) {
+ if (ether_addr_equal(rec.address, addr)) {
rec.status = P80211ENUM_status_unspec_failure;
break;
}
@@ -1661,8 +1661,8 @@ static void prism2sta_inf_authreq_defer(wlandevice_t *wlandev,
if (rec.status == P80211ENUM_status_successful) {
for (i = 0; i < hw->authlist.cnt; i++)
- if (memcmp(rec.address, hw->authlist.addr[i], ETH_ALEN)
- == 0)
+ if (ether_addr_equal(rec.address,
+ hw->authlist.addr[i]))
break;
if (i >= hw->authlist.cnt) {