llvm.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH] lib80211: remove unused variables iv32 and iv16
@ 2023-05-17 12:33 Tom Rix
  2023-05-17 15:11 ` Simon Horman
  2023-06-05 11:59 ` Johannes Berg
  0 siblings, 2 replies; 3+ messages in thread
From: Tom Rix @ 2023-05-17 12:33 UTC (permalink / raw)
  To: johannes, davem, edumazet, kuba, pabeni, nathan, ndesaulniers
  Cc: linux-wireless, netdev, linux-kernel, llvm, Tom Rix

clang with W=1 reports
net/wireless/lib80211_crypt_tkip.c:667:7: error: variable 'iv32'
  set but not used [-Werror,-Wunused-but-set-variable]
                u32 iv32 = tkey->tx_iv32;
                    ^
This variable not used so remove it.
Then remove a similar iv16 variable.
Remove the comment because the length is returned.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 net/wireless/lib80211_crypt_tkip.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/net/wireless/lib80211_crypt_tkip.c b/net/wireless/lib80211_crypt_tkip.c
index 1b4d6c87a5c5..9b411b6a7b5d 100644
--- a/net/wireless/lib80211_crypt_tkip.c
+++ b/net/wireless/lib80211_crypt_tkip.c
@@ -662,12 +662,6 @@ static int lib80211_tkip_get_key(void *key, int len, u8 * seq, void *priv)
 	memcpy(key, tkey->key, TKIP_KEY_LEN);
 
 	if (seq) {
-		/* Return the sequence number of the last transmitted frame. */
-		u16 iv16 = tkey->tx_iv16;
-		u32 iv32 = tkey->tx_iv32;
-		if (iv16 == 0)
-			iv32--;
-		iv16--;
 		seq[0] = tkey->tx_iv16;
 		seq[1] = tkey->tx_iv16 >> 8;
 		seq[2] = tkey->tx_iv32;
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] lib80211: remove unused variables iv32 and iv16
  2023-05-17 12:33 [PATCH] lib80211: remove unused variables iv32 and iv16 Tom Rix
@ 2023-05-17 15:11 ` Simon Horman
  2023-06-05 11:59 ` Johannes Berg
  1 sibling, 0 replies; 3+ messages in thread
From: Simon Horman @ 2023-05-17 15:11 UTC (permalink / raw)
  To: Tom Rix
  Cc: johannes, davem, edumazet, kuba, pabeni, nathan, ndesaulniers,
	linux-wireless, netdev, linux-kernel, llvm

On Wed, May 17, 2023 at 08:33:10AM -0400, Tom Rix wrote:
> clang with W=1 reports
> net/wireless/lib80211_crypt_tkip.c:667:7: error: variable 'iv32'
>   set but not used [-Werror,-Wunused-but-set-variable]
>                 u32 iv32 = tkey->tx_iv32;
>                     ^
> This variable not used so remove it.
> Then remove a similar iv16 variable.
> Remove the comment because the length is returned.
> 
> Signed-off-by: Tom Rix <trix@redhat.com>

Reviewed-by: Simon Horman <simon.horman@corigine.com>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] lib80211: remove unused variables iv32 and iv16
  2023-05-17 12:33 [PATCH] lib80211: remove unused variables iv32 and iv16 Tom Rix
  2023-05-17 15:11 ` Simon Horman
@ 2023-06-05 11:59 ` Johannes Berg
  1 sibling, 0 replies; 3+ messages in thread
From: Johannes Berg @ 2023-06-05 11:59 UTC (permalink / raw)
  To: Tom Rix, davem, edumazet, kuba, pabeni, nathan, ndesaulniers
  Cc: linux-wireless, netdev, linux-kernel, llvm

On Wed, 2023-05-17 at 08:33 -0400, Tom Rix wrote:
> clang with W=1 reports
> net/wireless/lib80211_crypt_tkip.c:667:7: error: variable 'iv32'
>   set but not used [-Werror,-Wunused-but-set-variable]
>                 u32 iv32 = tkey->tx_iv32;
>                     ^
> This variable not used so remove it.
> Then remove a similar iv16 variable.
> Remove the comment because the length is returned.
> 
> Signed-off-by: Tom Rix <trix@redhat.com>
> ---
>  net/wireless/lib80211_crypt_tkip.c | 6 ------
>  1 file changed, 6 deletions(-)
> 
> diff --git a/net/wireless/lib80211_crypt_tkip.c b/net/wireless/lib80211_crypt_tkip.c
> index 1b4d6c87a5c5..9b411b6a7b5d 100644
> --- a/net/wireless/lib80211_crypt_tkip.c
> +++ b/net/wireless/lib80211_crypt_tkip.c
> @@ -662,12 +662,6 @@ static int lib80211_tkip_get_key(void *key, int len, u8 * seq, void *priv)
>  	memcpy(key, tkey->key, TKIP_KEY_LEN);
>  
>  	if (seq) {
> -		/* Return the sequence number of the last transmitted frame. */
> -		u16 iv16 = tkey->tx_iv16;
> -		u32 iv32 = tkey->tx_iv32;
> -		if (iv16 == 0)
> -			iv32--;
> -		iv16--;
> 

FWIW, this has come up before, and we weren't sure that this really is
right and shouldn't have reported the iv32/iv16 values out to userspace
...

That said, it's unlikely anyone would ever go and test his code again,
so I guess we might as well clean this up to get rid of the warning.

Maybe leave a comment?

johannes

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-06-05 12:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-17 12:33 [PATCH] lib80211: remove unused variables iv32 and iv16 Tom Rix
2023-05-17 15:11 ` Simon Horman
2023-06-05 11:59 ` Johannes Berg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).