aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/wfx/hif_tx_mib.h
diff options
context:
space:
mode:
authorJérôme Pouiller <jerome.pouiller@silabs.com>2019-10-08 09:42:58 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-10-08 14:41:13 +0200
commitc54f9f0e8c81192b17e2ae2eb7af6a037fd250a5 (patch)
tree6a2ff611c9d54efcc6ac368556db0c63691667bf /drivers/staging/wfx/hif_tx_mib.h
parentstaging: wlan-ng: p80211wep.c: use lib/crc32 (diff)
downloadlinux-dev-c54f9f0e8c81192b17e2ae2eb7af6a037fd250a5.tar.xz
linux-dev-c54f9f0e8c81192b17e2ae2eb7af6a037fd250a5.zip
staging: wfx: simplify memory allocation in wfx_update_filtering()
Original code did not handle case where kmalloc failed. By the way, it is more convenient to allocate and build HIF message in hif_set_beacon_filter_table() instead of to ask to caller function to build it. Fixes: 40115bbc40e2 ("staging: wfx: implement the rest of mac80211 API") Reported-by: kbuild test robot <lkp@intel.com> Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com> Link: https://lore.kernel.org/r/20191008094232.10014-2-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/wfx/hif_tx_mib.h')
-rw-r--r--drivers/staging/wfx/hif_tx_mib.h21
1 files changed, 15 insertions, 6 deletions
diff --git a/drivers/staging/wfx/hif_tx_mib.h b/drivers/staging/wfx/hif_tx_mib.h
index f6624a403016..167c5dec009f 100644
--- a/drivers/staging/wfx/hif_tx_mib.h
+++ b/drivers/staging/wfx/hif_tx_mib.h
@@ -86,13 +86,22 @@ static inline int hif_set_rx_filter(struct wfx_vif *wvif, bool filter_bssid,
}
static inline int hif_set_beacon_filter_table(struct wfx_vif *wvif,
- struct hif_mib_bcn_filter_table *ft)
+ int tbl_len,
+ struct hif_ie_table_entry *tbl)
{
- size_t buf_len = struct_size(ft, ie_table, ft->num_of_info_elmts);
-
- cpu_to_le32s(&ft->num_of_info_elmts);
- return hif_write_mib(wvif->wdev, wvif->id,
- HIF_MIB_ID_BEACON_FILTER_TABLE, ft, buf_len);
+ int ret;
+ struct hif_mib_bcn_filter_table *val;
+ int buf_len = struct_size(val, ie_table, tbl_len);
+
+ val = kzalloc(buf_len, GFP_KERNEL);
+ if (!val)
+ return -ENOMEM;
+ val->num_of_info_elmts = cpu_to_le32(tbl_len);
+ memcpy(val->ie_table, tbl, tbl_len * sizeof(*tbl));
+ ret = hif_write_mib(wvif->wdev, wvif->id,
+ HIF_MIB_ID_BEACON_FILTER_TABLE, val, buf_len);
+ kfree(val);
+ return ret;
}
static inline int hif_beacon_filter_control(struct wfx_vif *wvif,