mwifiex: Fix endianness for event TLV type TLV_BTCOEX_WL_SCANTIME
authorPrasun Maiti <prasunmaiti87@gmail.com>
Thu, 30 Jun 2016 08:31:23 +0000 (14:01 +0530)
committerKalle Valo <kvalo@codeaurora.org>
Fri, 8 Jul 2016 13:46:43 +0000 (16:46 +0300)
The two members min_scan_time and max_scan_time of structure
"mwifiex_ie_types_btcoex_scan_time" are of two bytes each. The values
are assigned directtly from firmware without endian conversion handling.
So, wrong datas will get saved in big-endian systems.

This patch converts the values into cpu's byte order before assigning them
into the local members.

Signed-off-by: Prasun Maiti <prasunmaiti87@gmail.com>
Acked-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/marvell/mwifiex/fw.h
drivers/net/wireless/marvell/mwifiex/sta_event.c

index cef72343f5b69c79a2242ff0318d135c0a0d4d82..5596b6be1898dbfbab10f2af976526dc0a86115a 100644 (file)
@@ -1961,8 +1961,8 @@ struct mwifiex_ie_types_btcoex_scan_time {
        struct mwifiex_ie_types_header header;
        u8 coex_scan;
        u8 reserved;
-       u16 min_scan_time;
-       u16 max_scan_time;
+       __le16 min_scan_time;
+       __le16 max_scan_time;
 } __packed;
 
 struct mwifiex_ie_types_btcoex_aggr_win_size {
index 7c01778b6bb51c749ae23a31987f9c323e75438e..a422f3306d4d36e1a126d00940dc3876b32e0d15 100644 (file)
@@ -474,8 +474,8 @@ void mwifiex_bt_coex_wlan_param_update_event(struct mwifiex_private *priv,
                        scantlv =
                            (struct mwifiex_ie_types_btcoex_scan_time *)tlv;
                        adapter->coex_scan = scantlv->coex_scan;
-                       adapter->coex_min_scan_time = scantlv->min_scan_time;
-                       adapter->coex_max_scan_time = scantlv->max_scan_time;
+                       adapter->coex_min_scan_time = le16_to_cpu(scantlv->min_scan_time);
+                       adapter->coex_max_scan_time = le16_to_cpu(scantlv->max_scan_time);
                        break;
 
                default: