mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Colin King (gmail)" <colin.i.king@gmail.com>
To: Johannes Berg <johannes@sipsolutions.net>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Cc: "linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Variables being modified but not used in net/wireless/lib80211_crypt_tkip.c
Date: Mon, 24 Oct 2022 15:00:59 +0100	[thread overview]
Message-ID: <aeec15d5-6f7a-2c4f-0f90-72c52d082ce8@gmail.com> (raw)

Hi,

I was reviewing some clang scan build static analysis results and found 
an interesting warning:

Source: net/wireless/lib80211_crypt_tkip.c

net/wireless/lib80211_crypt_tkip.c:667:7: warning: variable 'iv32' set 
but not used [-Wunused-but-set-variable]
                 u32 iv32 = tkey->tx_iv32;

The variables iv32 and iv16 are being decremented, but are not 
referenced after that. The seq[] array is being updated with the 
pre-decremented values. Is that correct?

         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;
                 seq[3] = tkey->tx_iv32 >> 8;
                 seq[4] = tkey->tx_iv32 >> 16;
                 seq[5] = tkey->tx_iv32 >> 24;
         }

         return TKIP_KEY_LEN;

Colin

             reply	other threads:[~2022-10-24 17:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-24 14:00 Colin King (gmail) [this message]
2022-11-22 21:35 ` Johannes Berg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aeec15d5-6f7a-2c4f-0f90-72c52d082ce8@gmail.com \
    --to=colin.i.king@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=johannes@sipsolutions.net \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®