From patchwork Fri Feb 9 16:16:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joe Perches X-Patchwork-Id: 10209531 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 48EC560245 for ; Fri, 9 Feb 2018 16:24:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3A07C2994D for ; Fri, 9 Feb 2018 16:24:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2DFAE29950; Fri, 9 Feb 2018 16:24:55 +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.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 9BE122994D for ; Fri, 9 Feb 2018 16:24:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752290AbeBIQYw (ORCPT ); Fri, 9 Feb 2018 11:24:52 -0500 Received: from smtprelay0158.hostedemail.com ([216.40.44.158]:49471 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752292AbeBIQYv (ORCPT ); Fri, 9 Feb 2018 11:24:51 -0500 X-Greylist: delayed 478 seconds by postgrey-1.27 at vger.kernel.org; Fri, 09 Feb 2018 11:24:51 EST Received: from smtprelay.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by smtpgrave08.hostedemail.com (Postfix) with ESMTP id 1C44B1802B41C for ; Fri, 9 Feb 2018 16:16:54 +0000 (UTC) Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay08.hostedemail.com (Postfix) with ESMTP id A3219182CED28; Fri, 9 Feb 2018 16:16:52 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-HE-Tag: vase85_1a48ec10c026 X-Filterd-Recvd-Size: 3368 Received: from XPS-9350 (unknown [47.151.150.235]) (Authenticated sender: joe@perches.com) by omf10.hostedemail.com (Postfix) with ESMTPA; Fri, 9 Feb 2018 16:16:51 +0000 (UTC) Message-ID: <1518193009.14014.6.camel@perches.com> Subject: Re: [PATCH] rtlwifi: rtl8192cu: remove pointless memcpy From: Joe Perches To: Arnd Bergmann , Ping-Ke Shih Cc: Kalle Valo , Johannes Berg , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Date: Fri, 09 Feb 2018 08:16:49 -0800 In-Reply-To: <20180209132531.2755482-1-arnd@arndb.de> References: <20180209132531.2755482-1-arnd@arndb.de> X-Mailer: Evolution 3.26.1-1 Mime-Version: 1.0 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 On Fri, 2018-02-09 at 14:24 +0100, Arnd Bergmann wrote: > gcc-8 points out that source and destination of the memcpy() are > always the same pointer, so the effect of memcpy() is undefined > here (its arguments must not overlap): > > drivers/net/wireless/realtek/rtlwifi/rtl8192cu/trx.c: In function '_rtl_rx_process': > drivers/net/wireless/realtek/rtlwifi/rtl8192cu/trx.c:430:2: error: 'memcpy' source argument is the same as destination [-Werror=restrict] > > Most likely this is harmless, but it's easy to just remove the > line and get rid of the warning. > > Signed-off-by: Arnd Bergmann > --- > drivers/net/wireless/realtek/rtlwifi/rtl8192cu/trx.c | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/trx.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/trx.c > index ac4a82de40c7..9ab56827124e 100644 > --- a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/trx.c > +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/trx.c > @@ -427,7 +427,6 @@ static void _rtl_rx_process(struct ieee80211_hw *hw, struct sk_buff *skb) > (u32)hdr->addr1[0], (u32)hdr->addr1[1], > (u32)hdr->addr1[2], (u32)hdr->addr1[3], > (u32)hdr->addr1[4], (u32)hdr->addr1[5]); > - memcpy(IEEE80211_SKB_RXCB(skb), rx_status, sizeof(*rx_status)); > ieee80211_rx(hw, skb); > } trivia: The RT_TRACE above this should probably use %pM too. Not submitted as it would just cause a conflict. --- drivers/net/wireless/realtek/rtlwifi/rtl8192cu/trx.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/trx.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/trx.c index ac4a82de40c7..61da667ed8ba 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/trx.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/trx.c @@ -422,11 +422,8 @@ static void _rtl_rx_process(struct ieee80211_hw *hw, struct sk_buff *skb) if (ieee80211_is_data(fc)) RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "Got data frame\n"); RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, - "Fram: fc = 0x%X addr1 = 0x%02X:0x%02X:0x%02X:0x%02X:0x%02X:0x%02X\n", - fc, - (u32)hdr->addr1[0], (u32)hdr->addr1[1], - (u32)hdr->addr1[2], (u32)hdr->addr1[3], - (u32)hdr->addr1[4], (u32)hdr->addr1[5]); + "Fram: fc = 0x%X addr1 = %pM\n", + fc, hdr->addr1); memcpy(IEEE80211_SKB_RXCB(skb), rx_status, sizeof(*rx_status)); ieee80211_rx(hw, skb); }