From patchwork Fri Feb 2 15:45:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 126739 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp757087ljc; Fri, 2 Feb 2018 07:46:31 -0800 (PST) X-Google-Smtp-Source: AH8x224fT+HouL36pOGO6zqTY76thH5VR1LBgigCWh/bk3c2VqeLkwZwOCZArORXyolfupN+lc6N X-Received: by 10.98.224.136 with SMTP id d8mr2483703pfm.56.1517586391396; Fri, 02 Feb 2018 07:46:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517586391; cv=none; d=google.com; s=arc-20160816; b=XdcJlKM3yT6/3oMMqHVfrGEVF3EkK+oO9RcVTIQfUfoWcBD061GRCsVTc0DgCLtPBs 96C8moOpUgQhwUHX3ngP9pgbUhHZxonEX1st78wSCCQXTVGHmeGqiIrT9C6N6UITAjHQ rM2cyLD1QM2fQ+nb8xR3+4TwX2g9MM+R/MWDIjh1jxxXk34VP40VuRZqelZfr1ugrQpD u7PBj35PwfY82RP4KkAatyIzawvpL36Akl7hIhGdS5xYLg2Y8jl7LJtnWEFTwrRe3EHp D63mSEhkhuxF0LXcvrpJswU2fst0ePDX1gUtET1Z/XA/MdQIUmADRD3MX+18yTuKt4T1 aOdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=n60tEG8k+Rjv+kDStMcyBRA+xp0g4brOLrjq+ku33so=; b=vC6D2NaR9Ls2Ehib1dKL85w72xPLPoZ886+JwVY6FWDHi9CH06IXvKhYitNM+BkEz2 Rm0uWiuXQt+Kpt5xYm+kdjrOqDHhlcnsGaP0aN7SmUNThsqLb/9srCI+Mw3QW3i4J2NT Occ7pzPLaMTe92wTEvvdvB4RLxw2LToR64VNDJ/714AUO72dr2k/AaF1REMfUecFp5pr 8KTzV3TrocLNZOx8SW2L7PTZae/FXFTQyotGlIGjxaX5FdV0UFIq9cHnqLGf1J5QbH1D wpF08bM/DgCE9D8ScrrPMfSB9HBPRcNTAPRtwQrfc9PR1pPR+4Yoo1PuKXNPHL75h1lk K3DQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m12-v6si1992263pln.737.2018.02.02.07.46.31; Fri, 02 Feb 2018 07:46:31 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751835AbeBBPq2 (ORCPT + 8 others); Fri, 2 Feb 2018 10:46:28 -0500 Received: from mout.kundenserver.de ([212.227.17.24]:44299 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751580AbeBBPq0 (ORCPT ); Fri, 2 Feb 2018 10:46:26 -0500 Received: from wuerfel.lan ([95.208.111.237]) by mrelayeu.kundenserver.de (mreue104 [212.227.15.145]) with ESMTPA (Nemesis) id 0LpeUg-1fBl240YbO-00fTUb; Fri, 02 Feb 2018 16:46:10 +0100 From: Arnd Bergmann To: Harish Patil , Manish Chopra , Dept-GELinuxNICDev@cavium.com Cc: Arnd Bergmann , "David S. Miller" , Kees Cook , Johannes Berg , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] net: qlge: use memmove instead of skb_copy_to_linear_data Date: Fri, 2 Feb 2018 16:45:44 +0100 Message-Id: <20180202154603.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UIEs3o3kYODvOh/pjpJVQUlN+YJnmdDg== Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org gcc-8 points out that the skb_copy_to_linear_data() argument points to the skb itself, which makes it run into a problem with overlapping memcpy arguments: In file included from include/linux/ip.h:20, from drivers/net/ethernet/qlogic/qlge/qlge_main.c:26: drivers/net/ethernet/qlogic/qlge/qlge_main.c: In function 'ql_realign_skb': include/linux/skbuff.h:3378:2: error: 'memcpy' source argument is the same as destination [-Werror=restrict] memcpy(skb->data, from, len); It's unclear to me what the best solution is, maybe it ought to use a different helper that adjusts the skb data in a safe way. Simply using memmove() here seems like the easiest workaround. Signed-off-by: Arnd Bergmann --- drivers/net/ethernet/qlogic/qlge/qlge_main.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) -- 2.9.0 diff --git a/drivers/net/ethernet/qlogic/qlge/qlge_main.c b/drivers/net/ethernet/qlogic/qlge/qlge_main.c index 7b97a9969046..50038d946ced 100644 --- a/drivers/net/ethernet/qlogic/qlge/qlge_main.c +++ b/drivers/net/ethernet/qlogic/qlge/qlge_main.c @@ -1747,8 +1747,7 @@ static void ql_realign_skb(struct sk_buff *skb, int len) */ skb->data -= QLGE_SB_PAD - NET_IP_ALIGN; skb->tail -= QLGE_SB_PAD - NET_IP_ALIGN; - skb_copy_to_linear_data(skb, temp_addr, - (unsigned int)len); + memmove(skb->data, temp_addr, len); } /*