summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/iwlwifi/mvm
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2015-08-11 00:45:03 +0300
committerEmmanuel Grumbach <emmanuel.grumbach@intel.com>2015-08-16 10:28:08 +0300
commit5b9d47cdde1aacaac9b9dcefe44ee3493dc5fd87 (patch)
treef70b63615fa47c92343bf48804508796f09b7fee /drivers/net/wireless/iwlwifi/mvm
parent3cd6e2f768851a760c072f0f84b9688b1755d24d (diff)
downloadlinux-5b9d47cdde1aacaac9b9dcefe44ee3493dc5fd87.tar.xz
iwlwifi: mvm: fix a range check in debugfs code
The &mvm->tof_data.range_req.ap[] array has IWL_MVM_TOF_MAX_APS elements so the check should be >= instead of >. Also the test can underflow so I have changed "i" to unsigned. Fixes: ce7929186a39 ('wlwifi: mvm: add basic Time of Flight (802.11mc FTM) support') Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/mvm')
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/debugfs-vif.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/net/wireless/iwlwifi/mvm/debugfs-vif.c b/drivers/net/wireless/iwlwifi/mvm/debugfs-vif.c
index ddb1c844827b..383a3162046c 100644
--- a/drivers/net/wireless/iwlwifi/mvm/debugfs-vif.c
+++ b/drivers/net/wireless/iwlwifi/mvm/debugfs-vif.c
@@ -911,9 +911,9 @@ static ssize_t iwl_dbgfs_tof_range_request_write(struct ieee80211_vif *vif,
int size = sizeof(struct iwl_tof_range_req_ap_entry);
u16 burst_period;
u8 *mac = ap.bssid;
- int i;
+ unsigned int i;
- if (sscanf(data, "%d %hhd %hhx %hhx"
+ if (sscanf(data, "%u %hhd %hhx %hhx"
"%hhx:%hhx:%hhx:%hhx:%hhx:%hhx"
"%hhx %hhx %hx"
"%hhx %hhx %x"
@@ -929,7 +929,7 @@ static ssize_t iwl_dbgfs_tof_range_request_write(struct ieee80211_vif *vif,
ret = -EINVAL;
goto out;
}
- if (i > IWL_MVM_TOF_MAX_APS) {
+ if (i >= IWL_MVM_TOF_MAX_APS) {
IWL_ERR(mvm, "Invalid AP index %d\n", i);
ret = -EINVAL;
goto out;