* [PATCH] iwlwifi: mvm: fix iwl_mvm_sar_find_wifi_pkg corner case
@ 2017-06-27 15:24 Arnd Bergmann
2017-06-28 11:59 ` Luca Coelho
0 siblings, 1 reply; 3+ messages in thread
From: Arnd Bergmann @ 2017-06-27 15:24 UTC (permalink / raw)
To: Johannes Berg, Luca Coelho
Cc: Arnd Bergmann, Emmanuel Grumbach, Intel Linux Wireless,
Kalle Valo, Sara Sharon, Golan Ben-Ami, Liad Kaufman,
Haim Dreyfuss, linux-wireless, netdev, linux-kernel
gcc warns about what it thinks is an uninitialized variable
access:
drivers/net/wireless/intel/iwlwifi/mvm/fw.c: In function 'iwl_mvm_sar_find_wifi_pkg.isra.14':
drivers/net/wireless/intel/iwlwifi/mvm/fw.c:1102:5: error: 'wifi_pkg' may be used uninitialized in this function [-Werror=maybe-uninitialized]
That problem cannot really happen, as we check data->package.count
to ensure that the loop is entered at least once.
However, something that can indeed happen is returning an incorrect
wifi_pkg pointer in case none of the elements are what we are looking
for.
This modifies the loop again, to only return a correct object, and
to shut up that warning.
Fixes: c386dacb4ed6 ("iwlwifi: mvm: refactor SAR init to prepare for dynamic SAR")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/net/wireless/intel/iwlwifi/mvm/fw.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
index 24cc406d87ef..730c7f68c0b3 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
@@ -1094,14 +1094,12 @@ static union acpi_object *iwl_mvm_sar_find_wifi_pkg(struct iwl_mvm *mvm,
domain = &wifi_pkg->package.elements[0];
if (domain->type == ACPI_TYPE_INTEGER &&
domain->integer.value == ACPI_WIFI_DOMAIN)
- break;
-
- wifi_pkg = NULL;
+ goto found;
}
- if (!wifi_pkg)
- return ERR_PTR(-ENOENT);
+ return ERR_PTR(-ENOENT);
+found:
return wifi_pkg;
}
--
2.9.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] iwlwifi: mvm: fix iwl_mvm_sar_find_wifi_pkg corner case
2017-06-27 15:24 [PATCH] iwlwifi: mvm: fix iwl_mvm_sar_find_wifi_pkg corner case Arnd Bergmann
@ 2017-06-28 11:59 ` Luca Coelho
0 siblings, 0 replies; 3+ messages in thread
From: Luca Coelho @ 2017-06-28 11:59 UTC (permalink / raw)
To: Arnd Bergmann, Johannes Berg
Cc: Emmanuel Grumbach, Intel Linux Wireless, Kalle Valo, Sara Sharon,
Golan Ben-Ami, Liad Kaufman, Haim Dreyfuss, linux-wireless,
netdev, linux-kernel
On Tue, 2017-06-27 at 17:24 +0200, Arnd Bergmann wrote:
> gcc warns about what it thinks is an uninitialized variable
> access:
>
> drivers/net/wireless/intel/iwlwifi/mvm/fw.c: In function 'iwl_mvm_sar_find_wifi_pkg.isra.14':
> drivers/net/wireless/intel/iwlwifi/mvm/fw.c:1102:5: error: 'wifi_pkg' may be used uninitialized in this function [-Werror=maybe-uninitialized]
>
> That problem cannot really happen, as we check data->package.count
> to ensure that the loop is entered at least once.
> However, something that can indeed happen is returning an incorrect
> wifi_pkg pointer in case none of the elements are what we are looking
> for.
>
> This modifies the loop again, to only return a correct object, and
> to shut up that warning.
>
> Fixes: c386dacb4ed6 ("iwlwifi: mvm: refactor SAR init to prepare for dynamic SAR")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
Thanks, Arnd!
I've pushed this to our internal tree and it will eventually reach the
mainline, via our normal upstreaming process.
--
Cheers,
Luca.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] iwlwifi: mvm: fix iwl_mvm_sar_find_wifi_pkg corner case
@ 2017-06-28 11:59 ` Luca Coelho
0 siblings, 0 replies; 3+ messages in thread
From: Luca Coelho @ 2017-06-28 11:59 UTC (permalink / raw)
To: Arnd Bergmann, Johannes Berg
Cc: Emmanuel Grumbach, Intel Linux Wireless, Kalle Valo, Sara Sharon,
Golan Ben-Ami, Liad Kaufman, Haim Dreyfuss, linux-wireless,
netdev, linux-kernel
On Tue, 2017-06-27 at 17:24 +0200, Arnd Bergmann wrote:
> gcc warns about what it thinks is an uninitialized variable
> access:
>
> drivers/net/wireless/intel/iwlwifi/mvm/fw.c: In function 'iwl_mvm_sar_find_wifi_pkg.isra.14':
> drivers/net/wireless/intel/iwlwifi/mvm/fw.c:1102:5: error: 'wifi_pkg' may be used uninitialized in this function [-Werror=maybe-uninitialized]
>
> That problem cannot really happen, as we check data->package.count
> to ensure that the loop is entered at least once.
> However, something that can indeed happen is returning an incorrect
> wifi_pkg pointer in case none of the elements are what we are looking
> for.
>
> This modifies the loop again, to only return a correct object, and
> to shut up that warning.
>
> Fixes: c386dacb4ed6 ("iwlwifi: mvm: refactor SAR init to prepare for dynamic SAR")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
Thanks, Arnd!
I've pushed this to our internal tree and it will eventually reach the
mainline, via our normal upstreaming process.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-06-28 11:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-27 15:24 [PATCH] iwlwifi: mvm: fix iwl_mvm_sar_find_wifi_pkg corner case Arnd Bergmann
2017-06-28 11:59 ` Luca Coelho
2017-06-28 11:59 ` Luca Coelho
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.