diff options
author | Johannes Berg <johannes.berg@intel.com> | 2015-03-31 09:12:54 +0200 |
---|---|---|
committer | Emmanuel Grumbach <emmanuel.grumbach@intel.com> | 2015-04-02 09:29:13 +0300 |
commit | 5d4f929e3d0c09838677a116ffd168d9d519ada7 (patch) | |
tree | 53c9caa380c065bc8862ddaa3de4227f2a2f8cc3 /drivers/net/wireless/iwlwifi/mvm/ops.c | |
parent | 0d365ae5f2715a4a749e41ce5e75e34f03090db6 (diff) | |
download | lwn-5d4f929e3d0c09838677a116ffd168d9d519ada7.tar.gz lwn-5d4f929e3d0c09838677a116ffd168d9d519ada7.zip |
iwlwifi: mvm: do string formatting in debug triggers
The current code has a lot of duplicates of printing into a buffer
(while having to make sure it's NUL-filled and -terminated) and
then passing that to the debug trigger collection.
Since that's error-prone, instead make the debug trigger collection
function take a format string and format arguments (with compiler
validity checking) and handle the buffer internally.
This makes one behavioural change -- instead of sending the whole
buffer to userspace (clearing is needed to not leak stack data) it
just passes the actual string (including NUL-terminator.)
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/mvm/ops.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/mvm/ops.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/net/wireless/iwlwifi/mvm/ops.c b/drivers/net/wireless/iwlwifi/mvm/ops.c index 67ed57e17dab..e656511bdbec 100644 --- a/drivers/net/wireless/iwlwifi/mvm/ops.c +++ b/drivers/net/wireless/iwlwifi/mvm/ops.c @@ -689,7 +689,6 @@ static inline void iwl_mvm_rx_check_trigger(struct iwl_mvm *mvm, { struct iwl_fw_dbg_trigger_tlv *trig; struct iwl_fw_dbg_trigger_cmd *cmds_trig; - char buf[32]; int i; if (!iwl_fw_dbg_trigger_enabled(mvm->fw, FW_DBG_TRIGGER_FW_NOTIF)) @@ -709,9 +708,9 @@ static inline void iwl_mvm_rx_check_trigger(struct iwl_mvm *mvm, if (cmds_trig->cmds[i].cmd_id != pkt->hdr.cmd) continue; - memset(buf, 0, sizeof(buf)); - snprintf(buf, sizeof(buf), "CMD 0x%02x received", pkt->hdr.cmd); - iwl_mvm_fw_dbg_collect_trig(mvm, trig, buf, sizeof(buf)); + iwl_mvm_fw_dbg_collect_trig(mvm, trig, + "CMD 0x%02x received", + pkt->hdr.cmd); break; } } |