staging: wlan-ng: Use little-endian type

Fix the following sparse warning:
drivers/staging//wlan-ng/prism2sta.c:1691:20: warning: incorrect type in assignment (different base types)

The authantication data is in little endian order. Change the types to little endian order:
(a) Change struct hfa384x_authenticate_station_data status, algorithm members type to __le16.
(b) Change struct hfa384x_auth_request algorithm member type to __le16.
(c) All assignment to status are converted to little-endian prior to assignment.

Signed-off-by: Aviv Palivoda <palaviv@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Aviv Palivoda 2017-07-13 19:42:47 +03:00 committed by Greg Kroah-Hartman
parent 5311678279
commit e708d2c740
2 changed files with 11 additions and 12 deletions

View File

@ -413,8 +413,8 @@ struct hfa384x_join_request_data {
/*-- Configuration Record: authenticateStation (data portion only) --*/ /*-- Configuration Record: authenticateStation (data portion only) --*/
struct hfa384x_authenticate_station_data { struct hfa384x_authenticate_station_data {
u8 address[ETH_ALEN]; u8 address[ETH_ALEN];
u16 status; __le16 status;
u16 algorithm; __le16 algorithm;
} __packed; } __packed;
/*-- Configuration Record: WPAData (data portion only) --*/ /*-- Configuration Record: WPAData (data portion only) --*/
@ -733,7 +733,7 @@ struct hfa384x_assoc_status {
struct hfa384x_auth_request { struct hfa384x_auth_request {
u8 sta_addr[ETH_ALEN]; u8 sta_addr[ETH_ALEN];
u16 algorithm; __le16 algorithm;
} __packed; } __packed;
/*-- Unsolicited Frame, MAC Mgmt: PSUserCount (AP Only) --*/ /*-- Unsolicited Frame, MAC Mgmt: PSUserCount (AP Only) --*/

View File

@ -1561,7 +1561,7 @@ static void prism2sta_inf_authreq_defer(struct wlandevice *wlandev,
*/ */
ether_addr_copy(rec.address, inf->info.authreq.sta_addr); ether_addr_copy(rec.address, inf->info.authreq.sta_addr);
rec.status = P80211ENUM_status_unspec_failure; rec.status = cpu_to_le16(P80211ENUM_status_unspec_failure);
/* /*
* Authenticate based on the access mode. * Authenticate based on the access mode.
@ -1578,7 +1578,7 @@ static void prism2sta_inf_authreq_defer(struct wlandevice *wlandev,
for (i = 0; i < hw->authlist.cnt; i++) for (i = 0; i < hw->authlist.cnt; i++)
if (ether_addr_equal(rec.address, if (ether_addr_equal(rec.address,
hw->authlist.addr[i])) { hw->authlist.addr[i])) {
rec.status = P80211ENUM_status_successful; rec.status = cpu_to_le16(P80211ENUM_status_successful);
break; break;
} }
@ -1590,7 +1590,7 @@ static void prism2sta_inf_authreq_defer(struct wlandevice *wlandev,
* Allow all authentications. * Allow all authentications.
*/ */
rec.status = P80211ENUM_status_successful; rec.status = cpu_to_le16(P80211ENUM_status_successful);
break; break;
case WLAN_ACCESS_ALLOW: case WLAN_ACCESS_ALLOW:
@ -1615,7 +1615,7 @@ static void prism2sta_inf_authreq_defer(struct wlandevice *wlandev,
for (i = 0; i < cnt; i++, addr += ETH_ALEN) for (i = 0; i < cnt; i++, addr += ETH_ALEN)
if (ether_addr_equal(rec.address, addr)) { if (ether_addr_equal(rec.address, addr)) {
rec.status = P80211ENUM_status_successful; rec.status = cpu_to_le16(P80211ENUM_status_successful);
break; break;
} }
@ -1641,11 +1641,11 @@ static void prism2sta_inf_authreq_defer(struct wlandevice *wlandev,
addr = hw->deny.addr1[0]; addr = hw->deny.addr1[0];
} }
rec.status = P80211ENUM_status_successful; rec.status = cpu_to_le16(P80211ENUM_status_successful);
for (i = 0; i < cnt; i++, addr += ETH_ALEN) for (i = 0; i < cnt; i++, addr += ETH_ALEN)
if (ether_addr_equal(rec.address, addr)) { if (ether_addr_equal(rec.address, addr)) {
rec.status = P80211ENUM_status_unspec_failure; rec.status = cpu_to_le16(P80211ENUM_status_unspec_failure);
break; break;
} }
@ -1663,7 +1663,7 @@ static void prism2sta_inf_authreq_defer(struct wlandevice *wlandev,
added = 0; added = 0;
if (rec.status == P80211ENUM_status_successful) { if (rec.status == cpu_to_le16(P80211ENUM_status_successful)) {
for (i = 0; i < hw->authlist.cnt; i++) for (i = 0; i < hw->authlist.cnt; i++)
if (ether_addr_equal(rec.address, if (ether_addr_equal(rec.address,
hw->authlist.addr[i])) hw->authlist.addr[i]))
@ -1671,7 +1671,7 @@ static void prism2sta_inf_authreq_defer(struct wlandevice *wlandev,
if (i >= hw->authlist.cnt) { if (i >= hw->authlist.cnt) {
if (hw->authlist.cnt >= WLAN_AUTH_MAX) { if (hw->authlist.cnt >= WLAN_AUTH_MAX) {
rec.status = P80211ENUM_status_ap_full; rec.status = cpu_to_le16(P80211ENUM_status_ap_full);
} else { } else {
ether_addr_copy( ether_addr_copy(
hw->authlist.addr[hw->authlist.cnt], hw->authlist.addr[hw->authlist.cnt],
@ -1688,7 +1688,6 @@ static void prism2sta_inf_authreq_defer(struct wlandevice *wlandev,
* it was added. * it was added.
*/ */
rec.status = cpu_to_le16(rec.status);
rec.algorithm = inf->info.authreq.algorithm; rec.algorithm = inf->info.authreq.algorithm;
result = hfa384x_drvr_setconfig(hw, HFA384x_RID_AUTHENTICATESTA, result = hfa384x_drvr_setconfig(hw, HFA384x_RID_AUTHENTICATESTA,