From: Luca Coelho <luca@coelho.fi>
To: kvalo@codeaurora.org
Cc: linux-wireless@vger.kernel.org,
Emmanuel Grumbach <emmanuel.grumbach@intel.com>,
Luca Coelho <luciano.coelho@intel.com>
Subject: [PATCH 04/16] iwlwiif: mvm: refactor iwl_mvm_notify_rx_queue
Date: Sat, 20 Jul 2019 13:25:33 +0300 [thread overview]
Message-ID: <20190720102545.5952-5-luca@coelho.fi> (raw)
In-Reply-To: <20190720102545.5952-1-luca@coelho.fi>
From: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Instead of allocating memory for which we have an upper
limit, use a small buffer on stack.
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
---
drivers/net/wireless/intel/iwlwifi/fw/api/rx.h | 1 -
drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c | 17 +++++++++--------
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/drivers/net/wireless/intel/iwlwifi/fw/api/rx.h b/drivers/net/wireless/intel/iwlwifi/fw/api/rx.h
index ed69eec4fcd9..9b0bb89599fc 100644
--- a/drivers/net/wireless/intel/iwlwifi/fw/api/rx.h
+++ b/drivers/net/wireless/intel/iwlwifi/fw/api/rx.h
@@ -776,7 +776,6 @@ struct iwl_rss_config_cmd {
u8 indirection_table[IWL_RSS_INDIRECTION_TABLE_SIZE];
} __packed; /* RSS_CONFIG_CMD_API_S_VER_1 */
-#define IWL_MULTI_QUEUE_SYNC_MSG_MAX_SIZE 128
#define IWL_MULTI_QUEUE_SYNC_SENDER_POS 0
#define IWL_MULTI_QUEUE_SYNC_SENDER_MSK 0xf
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c b/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c
index bf097329efa2..16078aa7c95f 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c
@@ -465,18 +465,20 @@ static bool iwl_mvm_is_dup(struct ieee80211_sta *sta, int queue,
int iwl_mvm_notify_rx_queue(struct iwl_mvm *mvm, u32 rxq_mask,
const u8 *data, u32 count)
{
- struct iwl_rxq_sync_cmd *cmd;
+ u8 buf[sizeof(struct iwl_rxq_sync_cmd) +
+ sizeof(struct iwl_mvm_rss_sync_notif)];
+ struct iwl_rxq_sync_cmd *cmd = (void *)buf;
u32 data_size = sizeof(*cmd) + count;
int ret;
- /* should be DWORD aligned */
- if (WARN_ON(count & 3 || count > IWL_MULTI_QUEUE_SYNC_MSG_MAX_SIZE))
+ /*
+ * size must be a multiple of DWORD
+ * Ensure we don't overflow buf
+ */
+ if (WARN_ON(count & 3 ||
+ count > sizeof(struct iwl_mvm_rss_sync_notif)))
return -EINVAL;
- cmd = kzalloc(data_size, GFP_KERNEL);
- if (!cmd)
- return -ENOMEM;
-
cmd->rxq_mask = cpu_to_le32(rxq_mask);
cmd->count = cpu_to_le32(count);
cmd->flags = 0;
@@ -487,7 +489,6 @@ int iwl_mvm_notify_rx_queue(struct iwl_mvm *mvm, u32 rxq_mask,
TRIGGER_RX_QUEUES_NOTIF_CMD),
0, data_size, cmd);
- kfree(cmd);
return ret;
}
--
2.20.1
next prev parent reply other threads:[~2019-07-20 10:26 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-20 10:25 [PATCH 00/16] iwlwifi: fixes intended for 5.3 2019-07-20 Luca Coelho
2019-07-20 10:25 ` [PATCH 01/16] iwlwifi: mvm: don't send GEO_TX_POWER_LIMIT on version < 41 Luca Coelho
[not found] ` <20190720122332.E229E2186A@mail.kernel.org>
2019-08-05 9:45 ` Luca Coelho
2019-07-20 10:25 ` [PATCH 02/16] iwlwifi: mvm: prepare the ground for more RSS notifications Luca Coelho
2019-07-20 10:25 ` [PATCH 03/16] iwlwifi: mvm: add a new RSS sync notification for NSSN sync Luca Coelho
2019-07-20 10:25 ` Luca Coelho [this message]
2019-07-20 10:25 ` [PATCH 05/16] iwlwifi: mvm: add a loose synchronization of the NSSN across Rx queues Luca Coelho
2019-07-20 10:25 ` [PATCH 06/16] iwlwifi: mvm: add a wrapper around rs_tx_status to handle locks Luca Coelho
2019-07-20 10:25 ` [PATCH 07/16] iwlwifi: dbg_ini: move iwl_dbg_tlv_load_bin out of debug override ifdef Luca Coelho
2019-07-20 10:25 ` [PATCH 08/16] iwlwifi: dbg_ini: move iwl_dbg_tlv_free outside of debugfs ifdef Luca Coelho
2019-07-20 10:25 ` [PATCH 09/16] iwlwifi: fix locking in delayed GTK setting Luca Coelho
2019-07-20 10:25 ` [PATCH 10/16] iwlwifi: mvm: fix comparison of u32 variable with less than zero Luca Coelho
2019-07-20 10:25 ` [PATCH 11/16] iwlwifi: mvm: send LQ command always ASYNC Luca Coelho
2019-07-20 10:25 ` [PATCH 12/16] iwlwifi: mvm: replace RS mutex with a spin_lock Luca Coelho
2019-07-20 10:25 ` [PATCH 13/16] iwlwifi: mvm: fix frame drop from the reordering buffer Luca Coelho
2019-07-20 10:25 ` [PATCH 14/16] iwlwifi: mvm: fix possible out-of-bounds read when accessing lq_info Luca Coelho
2019-07-20 10:25 ` [PATCH 15/16] iwlwifi: add 3 new IDs for the 9000 series (iwl9260_2ac_160_cfg) Luca Coelho
2019-07-20 10:25 ` [PATCH 16/16] iwlwifi: mvm: fix version check for GEO_TX_POWER_LIMIT support Luca Coelho
2019-08-01 14:07 ` Jonas Hahnfeld
2019-08-22 6:44 ` Luca Coelho
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190720102545.5952-5-luca@coelho.fi \
--to=luca@coelho.fi \
--cc=emmanuel.grumbach@intel.com \
--cc=kvalo@codeaurora.org \
--cc=linux-wireless@vger.kernel.org \
--cc=luciano.coelho@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).