staging: prism2sta: Replace memcpy with ether_add_copy

Replace memcpy() with ether_addr_copy() since addresses are __aligned(2).
The 2 structures are aligned to u16 as showed below:

typedef struct hfa384x_authenticateStation_data {
u8 address[ETH_ALEN];                           /* 0    6 */
u16 status;                                     /* 6    2 */
u16 algorithm;                                  /* 8    2 */
} __packed hfa384x_authenticateStation_data_t;

Total size: 10

typedef struct hfa384x_AuthRequest {
u8 sta_addr[ETH_ALEN];                          /* 0    6 */
u16 algorithm;                                  /* 6    2 */
} __packed hfa384x_AuthReq_t;
Total size: 8

Signed-off-by: Ioana Ciornei <ciorneiioana@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Ioana Ciornei 2015-03-18 15:26:05 +02:00 committed by Greg Kroah-Hartman
parent ec523735e4
commit 7078db9dff
1 changed files with 4 additions and 3 deletions

View File

@ -59,6 +59,7 @@
#include <linux/netdevice.h>
#include <linux/workqueue.h>
#include <linux/byteorder/generic.h>
#include <linux/etherdevice.h>
#include <linux/io.h>
#include <linux/delay.h>
@ -1544,7 +1545,7 @@ static void prism2sta_inf_authreq_defer(wlandevice_t *wlandev,
** authentication.
*/
memcpy(rec.address, inf->info.authreq.sta_addr, ETH_ALEN);
ether_addr_copy(rec.address, inf->info.authreq.sta_addr);
rec.status = P80211ENUM_status_unspec_failure;
/*
@ -1657,8 +1658,8 @@ static void prism2sta_inf_authreq_defer(wlandevice_t *wlandev,
if (hw->authlist.cnt >= WLAN_AUTH_MAX) {
rec.status = P80211ENUM_status_ap_full;
} else {
memcpy(hw->authlist.addr[hw->authlist.cnt],
rec.address, ETH_ALEN);
ether_addr_copy(hw->authlist.addr[hw->authlist.cnt],
rec.address);
hw->authlist.cnt++;
added = 1;
}