iwlwifi: mvm: writing zero bytes to debugfs causes a crash
commitbcb28cb399309a4c1172b748704a1682cad7f4de
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 23 Mar 2017 10:40:00 +0000 (23 13:40 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 14 May 2017 12:08:24 +0000 (14 14:08 +0200)
tree1eda151470e51d196707cae8b25cfe1439aad6bc
parentbd78746f3225df60d5d6818009b9e4fa9dc44047
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>
drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c