mwifiex: Copy scan_cfg_out->specific_bssid for proper alignment
MAC addresses passed into is_zero_ether_addr() must be two byte aligned.
scan_cfg_out->specific_bssid is not two byte aligned which is why we
make a temporary copy and pass that copy into is_zero_ether_addr().
This previously caused misaligned exceptions on the ARC 750D platform.
Change-Id: I7a5ec790fb25e002796b13f7514e44635052c4d3
diff --git a/drivers/net/wireless/marvell/mwifiex/scan.c b/drivers/net/wireless/marvell/mwifiex/scan.c
index d919fe6..089c829 100644
--- a/drivers/net/wireless/marvell/mwifiex/scan.c
+++ b/drivers/net/wireless/marvell/mwifiex/scan.c
@@ -859,6 +859,13 @@
*scan_current_only = false;
if (user_scan_in) {
+ /*
+ * MAC addresses need to be aligned on a 16 bit boundary for
+ * is_zero_ether_addr() to work. We copy
+ * scan_cfg_out->specific_bssid into this tmp variable because
+ * the former is not 16 bit aligned.
+ */
+ u16 tmpaddr[DIV_ROUND_UP(ETH_ALEN,sizeof(u16))];
/* Default the ssid_filter flag to TRUE, set false under
certain wildcard conditions and qualified by the existence
@@ -883,8 +890,9 @@
user_scan_in->specific_bssid,
sizeof(scan_cfg_out->specific_bssid));
+ memcpy(tmpaddr, scan_cfg_out->specific_bssid, ETH_ALEN);
if (adapter->ext_scan &&
- !is_zero_ether_addr(scan_cfg_out->specific_bssid)) {
+ !is_zero_ether_addr( (u8*) tmpaddr)) {
bssid_tlv =
(struct mwifiex_ie_types_bssid_list *)tlv_pos;
bssid_tlv->header.type = cpu_to_le16(TLV_TYPE_BSSID);
@@ -947,8 +955,9 @@
* truncate scan results. That is not an issue with an SSID
* or BSSID filter applied to the scan results in the firmware.
*/
+ memcpy(tmpaddr, scan_cfg_out->specific_bssid, ETH_ALEN);
if ((i && ssid_filter) ||
- !is_zero_ether_addr(scan_cfg_out->specific_bssid))
+ !is_zero_ether_addr( (u8*) tmpaddr))
*filtered_scan = true;
if (user_scan_in->scan_chan_gap) {