diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2017-03-23 06:40:00 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-05-14 08:00:17 -0400 |
commit | 3b141e2965a7bcb7b0699ad2aa30c2fb5f0ef303 (patch) | |
tree | 5960b42d63e5e591cf93378058ae691a6210c142 | |
parent | 1fb264cf7d54d8ac69adb72aec26933c1a7b8895 (diff) |
iwlwifi: mvm: writing zero bytes to debugfs causes a crash
commit 251fe09f13bfb54c1ede66ee8bf8ddd0061c4f7c upstream.
This is a static analysis fix. The warning is:
drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.c:912 iwl_mvm_fw_dbg_collect()
warn: integer overflows 'sizeof(*desc) + len'
I guess this code is supposed to take a NUL character, but if we write
zero bytes then it tries to write -1 characters and crashes.
Fixes: c91b865cb14d ("iwlwifi: mvm: support description for user triggered fw dbg collection")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c index 7b7d2a146e30..0bda91ffc608 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c | |||
@@ -1056,6 +1056,8 @@ static ssize_t iwl_dbgfs_fw_dbg_collect_write(struct iwl_mvm *mvm, | |||
1056 | 1056 | ||
1057 | if (ret) | 1057 | if (ret) |
1058 | return ret; | 1058 | return ret; |
1059 | if (count == 0) | ||
1060 | return 0; | ||
1059 | 1061 | ||
1060 | iwl_mvm_fw_dbg_collect(mvm, FW_DBG_TRIGGER_USER, buf, | 1062 | iwl_mvm_fw_dbg_collect(mvm, FW_DBG_TRIGGER_USER, buf, |
1061 | (count - 1), NULL); | 1063 | (count - 1), NULL); |