From patchwork Sun Sep 6 14:18:58 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Buesch X-Patchwork-Id: 45973 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n86EMawm004452 for ; Sun, 6 Sep 2009 14:22:36 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757942AbZIFOWc (ORCPT ); Sun, 6 Sep 2009 10:22:32 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756114AbZIFOWc (ORCPT ); Sun, 6 Sep 2009 10:22:32 -0400 Received: from bu3sch.de ([62.75.166.246]:51806 "EHLO vs166246.vserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754864AbZIFOWb (ORCPT ); Sun, 6 Sep 2009 10:22:31 -0400 Received: by vs166246.vserver.de with esmtpa (Exim 4.69) id 1MkIdU-0007uG-VR; Sun, 06 Sep 2009 14:22:33 +0000 From: Michael Buesch To: John Linville Subject: [PATCH] b43: Fix sparse warning in hw-tkip code Date: Sun, 6 Sep 2009 16:18:58 +0200 User-Agent: KMail/1.9.9 Cc: Broadcom Wireless , "linux-wireless" , gregor kowski MIME-Version: 1.0 Content-Disposition: inline Message-Id: <200909061618.58584.mb@bu3sch.de> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org 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] drivers/net/wireless/b43/xmit.c:272:18: got restricted unsigned short [usertype] The code should work correctly with and without this patch applied. Signed-off-by: Michael Buesch 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 {