diff mbox series

iwlwifi: mvm: initialize seq variable

Message ID 20220401230640.3196196-1-trix@redhat.com (mailing list archive)
State Awaiting Upstream
Delegated to: Netdev Maintainers
Headers show
Series iwlwifi: mvm: initialize seq variable | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch

Commit Message

Tom Rix April 1, 2022, 11:06 p.m. UTC
Clang static analysis reports this issue
d3.c:567:22: warning: The left operand of '>' is
  a garbage value
  if (seq.tkip.iv32 > cur_rx_iv32)
      ~~~~~~~~~~~~~ ^

seq is never initialized. Call ieee80211_get_key_rx_seq() to
initialize seq.

Fixes: 0419e5e672d6 ("iwlwifi: mvm: d3: separate TKIP data from key iteration")
Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/net/wireless/intel/iwlwifi/mvm/d3.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Nick Desaulniers April 5, 2022, 5:57 p.m. UTC | #1
On Fri, Apr 1, 2022 at 4:06 PM Tom Rix <trix@redhat.com> wrote:
>
> Clang static analysis reports this issue
> d3.c:567:22: warning: The left operand of '>' is
>   a garbage value
>   if (seq.tkip.iv32 > cur_rx_iv32)
>       ~~~~~~~~~~~~~ ^
>
> seq is never initialized. Call ieee80211_get_key_rx_seq() to
> initialize seq.
>
> Fixes: 0419e5e672d6 ("iwlwifi: mvm: d3: separate TKIP data from key iteration")
> Signed-off-by: Tom Rix <trix@redhat.com>

Thanks for the patch!
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>

> ---
>  drivers/net/wireless/intel/iwlwifi/mvm/d3.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/d3.c b/drivers/net/wireless/intel/iwlwifi/mvm/d3.c
> index a995bba0ba81..9b190b3ce6c1 100644
> --- a/drivers/net/wireless/intel/iwlwifi/mvm/d3.c
> +++ b/drivers/net/wireless/intel/iwlwifi/mvm/d3.c
> @@ -563,6 +563,7 @@ static void iwl_mvm_wowlan_get_tkip_data(struct ieee80211_hw *hw,
>                 }
>
>                 for (i = 0; i < IWL_NUM_RSC; i++) {
> +                       ieee80211_get_key_rx_seq(key, i, &seq);
>                         /* wrapping isn't allowed, AP must rekey */
>                         if (seq.tkip.iv32 > cur_rx_iv32)
>                                 cur_rx_iv32 = seq.tkip.iv32;
> --
> 2.27.0
>
diff mbox series

Patch

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/d3.c b/drivers/net/wireless/intel/iwlwifi/mvm/d3.c
index a995bba0ba81..9b190b3ce6c1 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/d3.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/d3.c
@@ -563,6 +563,7 @@  static void iwl_mvm_wowlan_get_tkip_data(struct ieee80211_hw *hw,
 		}
 
 		for (i = 0; i < IWL_NUM_RSC; i++) {
+			ieee80211_get_key_rx_seq(key, i, &seq);
 			/* wrapping isn't allowed, AP must rekey */
 			if (seq.tkip.iv32 > cur_rx_iv32)
 				cur_rx_iv32 = seq.tkip.iv32;