From patchwork Mon Oct 26 21:29:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 11858839 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E17F592C for ; Mon, 26 Oct 2020 21:33:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C64AA207F7 for ; Mon, 26 Oct 2020 21:33:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603748018; bh=zsdFRK78KKmwrwcAyPUjk92vDNhs3wUrIe6GE9ax80s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=z1GXzPGcl/J39C8Qu+yydTrC4UmCDMj3qfi8idFsQl7QdLHs+u84DE6+Rm5mofd2M i80fcXQufFpdjaGV/S5DWonsyUXj30DTHNieWPvxlgOcV8t3ywMc72kXMT/aDXB3em GqB4EVnD897SybfKg2cJUO9OTzRQvY9kmEyQDvMM= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389339AbgJZVdd (ORCPT ); Mon, 26 Oct 2020 17:33:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:44724 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389315AbgJZVdd (ORCPT ); Mon, 26 Oct 2020 17:33:33 -0400 Received: from localhost.localdomain (unknown [192.30.34.233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E43B4207C4; Mon, 26 Oct 2020 21:33:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603748013; bh=zsdFRK78KKmwrwcAyPUjk92vDNhs3wUrIe6GE9ax80s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YWK1ZZkcBliOfExdtIIuqKluve8nkz/DPJXW4xzjRoChOLErpR8rQH6rxJ5PJVIuG vSH5mn0VSEhGh6+K3j3ST/BKuIWLUSgPSmmvncubE96aJsXIXHOD9lpvHo+xHJZtmB bTwhjriX3fGW5g+GeS5U45FB1GknPc/RLR2epKyo= From: Arnd Bergmann To: QCA ath9k Development , Kalle Valo , "David S. Miller" , Jakub Kicinski Cc: Arnd Bergmann , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 08/11] ath9k: work around false-positive gcc warning Date: Mon, 26 Oct 2020 22:29:55 +0100 Message-Id: <20201026213040.3889546-8-arnd@kernel.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20201026213040.3889546-1-arnd@kernel.org> References: <20201026213040.3889546-1-arnd@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Arnd Bergmann gcc-10 shows a false-positive warning with CONFIG_KASAN: drivers/net/wireless/ath/ath9k/dynack.c: In function 'ath_dynack_sample_tx_ts': include/linux/etherdevice.h:290:14: warning: writing 4 bytes into a region of size 0 [-Wstringop-overflow=] 290 | *(u32 *)dst = *(const u32 *)src; | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~ Until gcc is fixed, work around this by using memcpy() in place of ether_addr_copy(). Hopefully gcc-11 will not have this problem. Link: https://godbolt.org/z/sab1MK Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97490 Signed-off-by: Arnd Bergmann --- drivers/net/wireless/ath/ath9k/dynack.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/wireless/ath/ath9k/dynack.c b/drivers/net/wireless/ath/ath9k/dynack.c index fbeb4a739d32..e4eb96b26ca4 100644 --- a/drivers/net/wireless/ath/ath9k/dynack.c +++ b/drivers/net/wireless/ath/ath9k/dynack.c @@ -247,8 +247,14 @@ void ath_dynack_sample_tx_ts(struct ath_hw *ah, struct sk_buff *skb, ridx = ts->ts_rateindex; da->st_rbf.ts[da->st_rbf.t_rb].tstamp = ts->ts_tstamp; +#if defined(CONFIG_KASAN) && (CONFIG_GCC_VERSION >= 100000) && (CONFIG_GCC_VERSION < 110000) + /* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97490 */ + memcpy(da->st_rbf.addr[da->st_rbf.t_rb].h_dest, hdr->addr1, ETH_ALEN); + memcpy(da->st_rbf.addr[da->st_rbf.t_rb].h_src, hdr->addr2, ETH_ALEN); +#else ether_addr_copy(da->st_rbf.addr[da->st_rbf.t_rb].h_dest, hdr->addr1); ether_addr_copy(da->st_rbf.addr[da->st_rbf.t_rb].h_src, hdr->addr2); +#endif if (!(info->status.rates[ridx].flags & IEEE80211_TX_RC_MCS)) { const struct ieee80211_rate *rate;