lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200115135338.14374-36-Jerome.Pouiller@silabs.com>
Date:   Wed, 15 Jan 2020 13:54:54 +0000
From:   Jérôme Pouiller <Jerome.Pouiller@...abs.com>
To:     "devel@...verdev.osuosl.org" <devel@...verdev.osuosl.org>,
        "linux-wireless@...r.kernel.org" <linux-wireless@...r.kernel.org>
CC:     "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Kalle Valo <kvalo@...eaurora.org>,
        "David S . Miller" <davem@...emloft.net>,
        Jérôme Pouiller <Jerome.Pouiller@...abs.com>
Subject: [PATCH v2 35/65] staging: wfx: simplify hif_set_mac_addr_condition()

From: Jérôme Pouiller <jerome.pouiller@...abs.com>

The structure hif_mib_mac_addr_data_frame_condition come from hardware
API. It is not intended to be manipulated in upper layers of the driver.

In add, current code for hif_set_mac_addr_condition() is too dumb. It
should pack data with hardware representation instead of leaving all
work to the caller.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@...abs.com>
---
 drivers/staging/wfx/hif_tx_mib.h | 10 ++++++++--
 drivers/staging/wfx/sta.c        |  9 +--------
 2 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/wfx/hif_tx_mib.h b/drivers/staging/wfx/hif_tx_mib.h
index ee22c7169fab..90474b1c5ec3 100644
--- a/drivers/staging/wfx/hif_tx_mib.h
+++ b/drivers/staging/wfx/hif_tx_mib.h
@@ -239,11 +239,17 @@ static inline int hif_set_tx_rate_retry_policy(struct wfx_vif *wvif,
 }
 
 static inline int hif_set_mac_addr_condition(struct wfx_vif *wvif,
-					     struct hif_mib_mac_addr_data_frame_condition *arg)
+					     int idx, const u8 *mac_addr)
 {
+	struct hif_mib_mac_addr_data_frame_condition val = {
+		.condition_idx = idx,
+		.address_type = HIF_MAC_ADDR_A1,
+	};
+
+	ether_addr_copy(val.mac_address, mac_addr);
 	return hif_write_mib(wvif->wdev, wvif->id,
 			     HIF_MIB_ID_MAC_ADDR_DATAFRAME_CONDITION,
-			     arg, sizeof(*arg));
+			     &val, sizeof(val));
 }
 
 static inline int hif_set_uc_mc_bc_condition(struct wfx_vif *wvif,
diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c
index 588094486a7a..b74e0ce41069 100644
--- a/drivers/staging/wfx/sta.c
+++ b/drivers/staging/wfx/sta.c
@@ -118,7 +118,6 @@ static int wfx_set_mcast_filter(struct wfx_vif *wvif,
 {
 	int i, ret;
 	struct hif_mib_config_data_filter config = { };
-	struct hif_mib_mac_addr_data_frame_condition filter_addr_val = { };
 
 	// Temporary workaround for filters
 	return hif_set_data_filtering(wvif, false, true);
@@ -126,14 +125,8 @@ static int wfx_set_mcast_filter(struct wfx_vif *wvif,
 	if (!fp->enable)
 		return hif_set_data_filtering(wvif, false, true);
 
-	// A1 Address match on list
 	for (i = 0; i < fp->num_addresses; i++) {
-		filter_addr_val.condition_idx = i;
-		filter_addr_val.address_type = HIF_MAC_ADDR_A1;
-		ether_addr_copy(filter_addr_val.mac_address,
-				fp->address_list[i]);
-		ret = hif_set_mac_addr_condition(wvif,
-						 &filter_addr_val);
+		ret = hif_set_mac_addr_condition(wvif, i, fp->address_list[i]);
 		if (ret)
 			return ret;
 		config.mac_cond |= 1 << i;
-- 
2.25.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ