Skip to content

Commit e708d2c

Browse files
palavivgregkh
authored andcommitted
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>
1 parent 5311678 commit e708d2c

2 files changed

Lines changed: 11 additions & 12 deletions

File tree

‎drivers/staging/wlan-ng/hfa384x.h‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -413,8 +413,8 @@ struct hfa384x_join_request_data {
413413
/*-- Configuration Record: authenticateStation (data portion only) --*/
414414
struct hfa384x_authenticate_station_data {
415415
u8 address[ETH_ALEN];
416-
u16 status;
417-
u16 algorithm;
416+
__le16 status;
417+
__le16 algorithm;
418418
} __packed;
419419

420420
/*-- Configuration Record: WPAData (data portion only) --*/
@@ -733,7 +733,7 @@ struct hfa384x_assoc_status {
733733

734734
struct hfa384x_auth_request {
735735
u8 sta_addr[ETH_ALEN];
736-
u16 algorithm;
736+
__le16 algorithm;
737737
} __packed;
738738

739739
/*-- Unsolicited Frame, MAC Mgmt: PSUserCount (AP Only) --*/

‎drivers/staging/wlan-ng/prism2sta.c‎

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1561,7 +1561,7 @@ static void prism2sta_inf_authreq_defer(struct wlandevice *wlandev,
15611561
*/
15621562

15631563
ether_addr_copy(rec.address, inf->info.authreq.sta_addr);
1564-
rec.status = P80211ENUM_status_unspec_failure;
1564+
rec.status = cpu_to_le16(P80211ENUM_status_unspec_failure);
15651565

15661566
/*
15671567
* Authenticate based on the access mode.
@@ -1578,7 +1578,7 @@ static void prism2sta_inf_authreq_defer(struct wlandevice *wlandev,
15781578
for (i = 0; i < hw->authlist.cnt; i++)
15791579
if (ether_addr_equal(rec.address,
15801580
hw->authlist.addr[i])) {
1581-
rec.status = P80211ENUM_status_successful;
1581+
rec.status = cpu_to_le16(P80211ENUM_status_successful);
15821582
break;
15831583
}
15841584

@@ -1590,7 +1590,7 @@ static void prism2sta_inf_authreq_defer(struct wlandevice *wlandev,
15901590
* Allow all authentications.
15911591
*/
15921592

1593-
rec.status = P80211ENUM_status_successful;
1593+
rec.status = cpu_to_le16(P80211ENUM_status_successful);
15941594
break;
15951595

15961596
case WLAN_ACCESS_ALLOW:
@@ -1615,7 +1615,7 @@ static void prism2sta_inf_authreq_defer(struct wlandevice *wlandev,
16151615

16161616
for (i = 0; i < cnt; i++, addr += ETH_ALEN)
16171617
if (ether_addr_equal(rec.address, addr)) {
1618-
rec.status = P80211ENUM_status_successful;
1618+
rec.status = cpu_to_le16(P80211ENUM_status_successful);
16191619
break;
16201620
}
16211621

@@ -1641,11 +1641,11 @@ static void prism2sta_inf_authreq_defer(struct wlandevice *wlandev,
16411641
addr = hw->deny.addr1[0];
16421642
}
16431643

1644-
rec.status = P80211ENUM_status_successful;
1644+
rec.status = cpu_to_le16(P80211ENUM_status_successful);
16451645

16461646
for (i = 0; i < cnt; i++, addr += ETH_ALEN)
16471647
if (ether_addr_equal(rec.address, addr)) {
1648-
rec.status = P80211ENUM_status_unspec_failure;
1648+
rec.status = cpu_to_le16(P80211ENUM_status_unspec_failure);
16491649
break;
16501650
}
16511651

@@ -1663,15 +1663,15 @@ static void prism2sta_inf_authreq_defer(struct wlandevice *wlandev,
16631663

16641664
added = 0;
16651665

1666-
if (rec.status == P80211ENUM_status_successful) {
1666+
if (rec.status == cpu_to_le16(P80211ENUM_status_successful)) {
16671667
for (i = 0; i < hw->authlist.cnt; i++)
16681668
if (ether_addr_equal(rec.address,
16691669
hw->authlist.addr[i]))
16701670
break;
16711671

16721672
if (i >= hw->authlist.cnt) {
16731673
if (hw->authlist.cnt >= WLAN_AUTH_MAX) {
1674-
rec.status = P80211ENUM_status_ap_full;
1674+
rec.status = cpu_to_le16(P80211ENUM_status_ap_full);
16751675
} else {
16761676
ether_addr_copy(
16771677
hw->authlist.addr[hw->authlist.cnt],
@@ -1688,7 +1688,6 @@ static void prism2sta_inf_authreq_defer(struct wlandevice *wlandev,
16881688
* it was added.
16891689
*/
16901690

1691-
rec.status = cpu_to_le16(rec.status);
16921691
rec.algorithm = inf->info.authreq.algorithm;
16931692

16941693
result = hfa384x_drvr_setconfig(hw, HFA384x_RID_AUTHENTICATESTA,

0 commit comments

Comments
 (0)