From patchwork Mon Oct 24 15:38:35 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 9392385 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id EEA4760762 for ; Mon, 24 Oct 2016 15:42:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E1B6F28757 for ; Mon, 24 Oct 2016 15:42:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D619629046; Mon, 24 Oct 2016 15:42:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.4 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 45F1B28757 for ; Mon, 24 Oct 2016 15:42:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S941003AbcJXPkk (ORCPT ); Mon, 24 Oct 2016 11:40:40 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:50150 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933767AbcJXPki (ORCPT ); Mon, 24 Oct 2016 11:40:38 -0400 Received: from wuerfel.lan. ([78.43.20.153]) by mrelayeu.kundenserver.de (mreue003) with ESMTPA (Nemesis) id 0Md04s-1cFoVM3eVu-00IByt; Mon, 24 Oct 2016 17:40:27 +0200 From: Arnd Bergmann To: Kalle Valo , Stanislav Yakovlev , Jouni Malinen , Johannes Berg , "David S. Miller" Cc: linux-wireless@vger.kernel.org, netdev@vger.kernel.org, Arnd Bergmann , linux-kernel@vger.kernel.org Subject: [PATCH] wireless: fix bogus maybe-uninitialized warning Date: Mon, 24 Oct 2016 17:38:35 +0200 Message-Id: <20161024153918.2810634-2-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20161024153918.2810634-1-arnd@arndb.de> References: <20161024153918.2810634-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K0:g0xuYPeZb4Xjp39Xu3j35HP0u1HEMF4riibpwPVt16po6nGJm2t VaYj92/JfVMl9qSoueKOCCwpGd2ywkAzJyDX/o0qzELoqfNzURR3l2/vf5PJFNt0QelNwbr zjyBGzISlEYu3iJF/55nM5S/VpXUQ7tnl5tXHYEVd+QPcmwccB6SINNnUT200/ruQmFOoXG 8L/SC0wCZkA9t6zLQwTig== X-UI-Out-Filterresults: notjunk:1; V01:K0:TvseWNgHk50=:HSxXZNQjjriyPsjQ1tw8HE exJk4YY8HAds2L/wKchPuZeKeCA5eSYvPBgNBVJ/fc/x3KooCKXKDsIX0VYG9DxzDxS/hmdvS cIbnqOpVKJ5NwNz8B3h26xDvXC8Cpb8zVwS3plN2ZWSCZhtB+pBdDseiKS8sBv7WBdggmwegn 3RnoRJmClFzfmqtK9Te2ipruWqxtCQlx3xSHqgequaK+SMMAqc6UAdyRCS8SFx2o322KnOEGz lWqiKvh+TTl+1nk4QpAp2yvmhcEA5BiIBw0sCpmjRZL5JM0lgVPWMhRjczWBmksK2TIaRkQcN JvXGlEYk0+AVBd5P65Q0S59gCwozmPIPX7cpv/cAglakA5PH9HCxHPpUQ57qMWDlUXdXV8trZ PJvG4ebcZwakw4n8D982WihTlU0qEWX8uj9c97uF7fBrVgDZAHcxEnpRa2eUrnF7TOnn0bwFF zdRisKbqO+Zs+C4yyR8ZgXDFPPZ/LRBYzEXwoo15xWRn74rJITdwiKSlMJ7IV2MozTkx9jX1X 1DJf12acQYM/7IQWaSDz6EwzvkTuvZ39snSWuvgw3P7oTp3dwEhi4oTT5IZqE0J1Q/78C+B5z G4BAJSyx9YgoNk8nQof79iy0zz15JuCK3DITO+VOzdiEM9tsPKiMdu7gGKlQQFokig3e/j6Ey nTd7L0I0tDNEsH5eo/uJ4f6ks0y5yHTUBmxxMiuJKzkEj01nOWW+6UiPrW5bebuJUFCSQ9E1e 6kxn3zd0BPBUxRdJ Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The hostap_80211_rx() function is supposed to set up the mac addresses for four possible cases, based on two bits of input data. For some reason, gcc decides that it's possible that none of the these four cases apply and the addresses remain uninitialized: drivers/net/wireless/intersil/hostap/hostap_80211_rx.c: In function ‘hostap_80211_rx’: arch/x86/include/asm/string_32.h:77:14: warning: ‘src’ may be used uninitialized in this function [-Wmaybe-uninitialized] drivers/net/wireless/intel/ipw2x00/libipw_rx.c: In function ‘libipw_rx’: arch/x86/include/asm/string_32.h:77:14: error: ‘dst’ may be used uninitialized in this function [-Werror=maybe-uninitialized] arch/x86/include/asm/string_32.h:78:22: error: ‘*((void *)&dst+4)’ may be used uninitialized in this function [-Werror=maybe-uninitialized] This warning is clearly nonsense, but changing the last case into 'default' makes it obvious to the compiler too, which avoids the warning and probably leads to better object code too. The same code is duplicated several times in the kernel, so this patch uses the same workaround for all copies. The exact configuration was hit only very rarely in randconfig builds and I only saw it in three drivers, but I assume that all of them are potentially affected, and it's better to keep the code consistent. Signed-off-by: Arnd Bergmann --- drivers/net/wireless/ath/ath6kl/wmi.c | 8 ++++---- drivers/net/wireless/intel/ipw2x00/libipw_rx.c | 2 +- drivers/net/wireless/intersil/hostap/hostap_80211_rx.c | 2 +- net/wireless/lib80211_crypt_tkip.c | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/net/wireless/ath/ath6kl/wmi.c b/drivers/net/wireless/ath/ath6kl/wmi.c index 3fd1cc98fd2f..84a6d12c3f8a 100644 --- a/drivers/net/wireless/ath/ath6kl/wmi.c +++ b/drivers/net/wireless/ath/ath6kl/wmi.c @@ -421,10 +421,6 @@ int ath6kl_wmi_dot11_hdr_remove(struct wmi *wmi, struct sk_buff *skb) switch ((le16_to_cpu(wh.frame_control)) & (IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS)) { - case 0: - memcpy(eth_hdr.h_dest, wh.addr1, ETH_ALEN); - memcpy(eth_hdr.h_source, wh.addr2, ETH_ALEN); - break; case IEEE80211_FCTL_TODS: memcpy(eth_hdr.h_dest, wh.addr3, ETH_ALEN); memcpy(eth_hdr.h_source, wh.addr2, ETH_ALEN); @@ -435,6 +431,10 @@ int ath6kl_wmi_dot11_hdr_remove(struct wmi *wmi, struct sk_buff *skb) break; case IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS: break; + default: + memcpy(eth_hdr.h_dest, wh.addr1, ETH_ALEN); + memcpy(eth_hdr.h_source, wh.addr2, ETH_ALEN); + break; } skb_pull(skb, sizeof(struct ath6kl_llc_snap_hdr)); diff --git a/drivers/net/wireless/intel/ipw2x00/libipw_rx.c b/drivers/net/wireless/intel/ipw2x00/libipw_rx.c index cef7f7d79cd9..1c1ec7bb9302 100644 --- a/drivers/net/wireless/intel/ipw2x00/libipw_rx.c +++ b/drivers/net/wireless/intel/ipw2x00/libipw_rx.c @@ -507,7 +507,7 @@ int libipw_rx(struct libipw_device *ieee, struct sk_buff *skb, memcpy(dst, hdr->addr3, ETH_ALEN); memcpy(src, hdr->addr4, ETH_ALEN); break; - case 0: + default: memcpy(dst, hdr->addr1, ETH_ALEN); memcpy(src, hdr->addr2, ETH_ALEN); break; diff --git a/drivers/net/wireless/intersil/hostap/hostap_80211_rx.c b/drivers/net/wireless/intersil/hostap/hostap_80211_rx.c index 599f30f22841..34dbddbf3f9b 100644 --- a/drivers/net/wireless/intersil/hostap/hostap_80211_rx.c +++ b/drivers/net/wireless/intersil/hostap/hostap_80211_rx.c @@ -855,7 +855,7 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb, memcpy(dst, hdr->addr3, ETH_ALEN); memcpy(src, hdr->addr4, ETH_ALEN); break; - case 0: + default: memcpy(dst, hdr->addr1, ETH_ALEN); memcpy(src, hdr->addr2, ETH_ALEN); break; diff --git a/net/wireless/lib80211_crypt_tkip.c b/net/wireless/lib80211_crypt_tkip.c index 71447cf86306..ba0a1f398ce5 100644 --- a/net/wireless/lib80211_crypt_tkip.c +++ b/net/wireless/lib80211_crypt_tkip.c @@ -556,7 +556,7 @@ static void michael_mic_hdr(struct sk_buff *skb, u8 * hdr) memcpy(hdr, hdr11->addr3, ETH_ALEN); /* DA */ memcpy(hdr + ETH_ALEN, hdr11->addr4, ETH_ALEN); /* SA */ break; - case 0: + default: memcpy(hdr, hdr11->addr1, ETH_ALEN); /* DA */ memcpy(hdr + ETH_ALEN, hdr11->addr2, ETH_ALEN); /* SA */ break;