linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Buesch <mb@bu3sch.de>
To: John Linville <linville@tuxdriver.com>
Cc: Broadcom Wireless <bcm43xx-dev@lists.berlios.de>,
	"linux-wireless" <linux-wireless@vger.kernel.org>,
	gregor kowski <gregor.kowski@gmail.com>
Subject: [PATCH] b43: Fix sparse warning in hw-tkip code
Date: Sun, 6 Sep 2009 16:18:58 +0200	[thread overview]
Message-ID: <200909061618.58584.mb@bu3sch.de> (raw)

This fixes a sparse warning in the hardware-TKIP code:

drivers/net/wireless/b43/xmit.c:272:18: warning: incorrect type in assignment (different base types)
drivers/net/wireless/b43/xmit.c:272:18:    expected unsigned short [unsigned] [short] <noident>
drivers/net/wireless/b43/xmit.c:272:18:    got restricted unsigned short [usertype] <noident>

The code should work correctly with and without this patch applied.

Signed-off-by: Michael Buesch <mb@bu3sch.de>


Index: wireless-testing/drivers/net/wireless/b43/xmit.c
===================================================================
--- wireless-testing.orig/drivers/net/wireless/b43/xmit.c	2009-09-06 16:10:22.000000000 +0200
+++ wireless-testing/drivers/net/wireless/b43/xmit.c	2009-09-06 16:17:08.000000000 +0200
@@ -267,11 +267,11 @@ int b43_generate_txhdr(struct b43_wldev 
 			 */
 			ieee80211_get_tkip_key(info->control.hw_key, skb_frag,
 					IEEE80211_TKIP_P1_KEY, (u8*)phase1key);
-			/* phase1key is in host endian */
-			for (i = 0; i < 5; i++)
-				phase1key[i] = cpu_to_le16(phase1key[i]);
-
-			memcpy(txhdr->iv, phase1key, 10);
+			/* phase1key is in host endian. Copy to little-endian txhdr->iv. */
+			for (i = 0; i < 5; i++) {
+				txhdr->iv[i * 2 + 0] = phase1key[i];
+				txhdr->iv[i * 2 + 1] = phase1key[i] >> 8;
+			}
 			/* iv16 */
 			memcpy(txhdr->iv + 10, ((u8 *) wlhdr) + wlhdr_len, 3);
 		} else {

-- 
Greetings, Michael.

                 reply	other threads:[~2009-09-06 14:22 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=200909061618.58584.mb@bu3sch.de \
    --to=mb@bu3sch.de \
    --cc=bcm43xx-dev@lists.berlios.de \
    --cc=gregor.kowski@gmail.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.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;
as well as URLs for NNTP newsgroup(s).