|
Oliver Neukum |
c845c9 |
From fb3c06cfda0db68f6082f05c43d63c1fb1761af0 Mon Sep 17 00:00:00 2001
|
|
Oliver Neukum |
c845c9 |
From: Luca Coelho <luciano.coelho@intel.com>
|
|
Oliver Neukum |
c845c9 |
Date: Mon, 23 Dec 2019 13:00:59 +0200
|
|
Oliver Neukum |
c845c9 |
Subject: [PATCH] iwlwifi: fw: make pos static in iwl_sar_get_ewrd_table() loop
|
|
Oliver Neukum |
c845c9 |
Git-commit: fb3c06cfda0db68f6082f05c43d63c1fb1761af0
|
|
Oliver Neukum |
c845c9 |
References: git-fixes
|
|
Oliver Neukum |
c845c9 |
Patch-mainline: v5.5
|
|
Oliver Neukum |
c845c9 |
|
|
Oliver Neukum |
c845c9 |
In the for loop where we are supposed to go through the entire table,
|
|
Oliver Neukum |
c845c9 |
we are using a non-static local to keep the pos index. This makes
|
|
Oliver Neukum |
c845c9 |
each iteration start with 3, so we always access the first item on the
|
|
Oliver Neukum |
c845c9 |
table. Fix this by moving the variable outside of the loo so it
|
|
Oliver Neukum |
c845c9 |
doesn't lose its value at every iteration.
|
|
Oliver Neukum |
c845c9 |
|
|
Oliver Neukum |
c845c9 |
Reported-by: Colin Ian King <colin.king@canonical.com>
|
|
Oliver Neukum |
c845c9 |
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
|
|
Oliver Neukum |
c845c9 |
Fixes: ba3224db7803 ("iwlwifi: mvm: fix an out-of-bound access")
|
|
Oliver Neukum |
c845c9 |
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
|
|
Oliver Neukum |
c845c9 |
Signed-off-by: Oliver Neukum <oneukum@suse.com>
|
|
Oliver Neukum |
c845c9 |
---
|
|
Oliver Neukum |
c845c9 |
drivers/net/wireless/intel/iwlwifi/mvm/fw.c | 7 +++----
|
|
Oliver Neukum |
c845c9 |
1 file changed, 3 insertions(+), 4 deletions(-)
|
|
Oliver Neukum |
c845c9 |
|
|
Oliver Neukum |
c845c9 |
--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
|
|
Oliver Neukum |
c845c9 |
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
|
|
Oliver Neukum |
c845c9 |
@@ -690,7 +690,7 @@ static int iwl_mvm_sar_get_ewrd_table(st
|
|
Oliver Neukum |
c845c9 |
{
|
|
Oliver Neukum |
c845c9 |
union acpi_object *wifi_pkg, *data;
|
|
Oliver Neukum |
c845c9 |
bool enabled;
|
|
Oliver Neukum |
c845c9 |
- int i, n_profiles, ret;
|
|
Oliver Neukum |
c845c9 |
+ int i, n_profiles, ret, pos;
|
|
Oliver Neukum |
c845c9 |
|
|
Oliver Neukum |
c845c9 |
data = iwl_acpi_get_object(mvm->dev, ACPI_EWRD_METHOD);
|
|
Oliver Neukum |
c845c9 |
if (IS_ERR(data))
|
|
Oliver Neukum |
c845c9 |
@@ -722,10 +722,9 @@ static int iwl_mvm_sar_get_ewrd_table(st
|
|
Oliver Neukum |
c845c9 |
goto out_free;
|
|
Oliver Neukum |
c845c9 |
}
|
|
Oliver Neukum |
c845c9 |
|
|
Oliver Neukum |
c845c9 |
+ /* the tables start at element 3 */
|
|
Oliver Neukum |
c845c9 |
+ pos = 3;
|
|
Oliver Neukum |
c845c9 |
for (i = 0; i < n_profiles; i++) {
|
|
Oliver Neukum |
c845c9 |
- /* the tables start at element 3 */
|
|
Oliver Neukum |
c845c9 |
- int pos = 3;
|
|
Oliver Neukum |
c845c9 |
-
|
|
Oliver Neukum |
c845c9 |
/* The EWRD profiles officially go from 2 to 4, but we
|
|
Oliver Neukum |
c845c9 |
* save them in sar_profiles[1-3] (because we don't
|
|
Oliver Neukum |
c845c9 |
* have profile 0). So in the array we start from 1.
|