From patchwork Thu Feb 22 15:55:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 129290 Delivered-To: patch@linaro.org Received: by 10.80.172.228 with SMTP id x91csp2169336edc; Thu, 22 Feb 2018 07:56:03 -0800 (PST) X-Google-Smtp-Source: AH8x227+gEzhuy5eeu/ix1hAV6wJ+6iA8HBjeQ4LZDyspA43QPJXvxFTNmX0wb4qHq7/xDrxbDMT X-Received: by 2002:a17:902:7182:: with SMTP id b2-v6mr6927542pll.331.1519314963606; Thu, 22 Feb 2018 07:56:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519314963; cv=none; d=google.com; s=arc-20160816; b=MNrnh9ZB2IsXZC2pU3P8MAIU8Q6zqH/WrO6hV/7VucsHP9AvucZN19J/bJHR0KiBuq +FrowFn1cb4vcTjNQcpfoJbl1Zlly1OOcReT3uzbo26aj0NMiixIC+SXXQ4dy9HeJS67 3RsiLR7mP9FoHZD8Ueac+qCjubNp3nMtdA81YUEhdC64WGa3jPOySLgZrtINx8KrFZyx VZMN3AK5ZOU3BDyvUKwhEj8VDwAL5WE1264x5A6xhi8+BC5gjPH1w1Fe/TDTaU02FMCN hrWG9hVj/E8XAEYAqvuW4YXGa7EtD9BKsmh9VNBrclyPgxI3QaEb8Z2zw9CBuFYiedCn 1KDQ== 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=ocGgBYeNqdUxJxjgr05frWYWbWfTIEDAnhgmcCtDfxg=; b=ayZbd5f5SFRrP+TN+HGiQGZFQbDlgzmqc/4VDs4Xs1HxZJqlp0JuedtpYOFuDSUYsa cayMS2e8yNasmmxiAnWJwiqC6Nys2bGwiQAfrXjCmUzt5zC3cKV45jlzhOc0avwIMuw9 Fy1h3sT++l5dYI8/FYhoFNp4RwFUzt6Y8F4rCp0sEk9VsQo87ZmbU6+I45o7jJcBUlpy JCEYNXekCjExVz1UYNPZCSGYRz7FyUodA5CXcfU+ne23ij5RsHSteBAzO9MnJM7M1b11 GmsPpAzDYEVSJEIA9sQ2alV4EtXsObkNpkauaCS5cG4hSR5/kXkl6Jn4YxYvGwjqbbE0 f7/Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-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 b86si222198pfd.345.2018.02.22.07.56.03; Thu, 22 Feb 2018 07:56:03 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of stable-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 stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933002AbeBVP4C (ORCPT + 10 others); Thu, 22 Feb 2018 10:56:02 -0500 Received: from mout.kundenserver.de ([217.72.192.75]:56989 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933001AbeBVP4B (ORCPT ); Thu, 22 Feb 2018 10:56:01 -0500 Received: from wuerfel.lan ([95.208.111.237]) by mrelayeu.kundenserver.de (mreue102 [212.227.15.145]) with ESMTPA (Nemesis) id 0MfYYl-1f8MBg00Hz-00P2Ko; Thu, 22 Feb 2018 16:55:51 +0100 From: Arnd Bergmann To: "David S. Miller" , Alexey Kuznetsov , Hideaki YOSHIFUJI Cc: Arnd Bergmann , stable@vger.kernel.org, Martin Sebor , David Ahern , Matthias Schiffer , Nicolas Dichtel , WANG Cong , Eric Dumazet , Craig Gallek , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] ipv6 sit: work around bogus gcc-8 -Wrestrict warning Date: Thu, 22 Feb 2018 16:55:34 +0100 Message-Id: <20180222155546.1747665-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:M8MVWfIicySQgoVUzu8cEuhR+hO9Q7VirmWjKHNEU4J74FhycuE t4g0us61p/wrPXGsQ2/cX1hBAW38P167jcYbx8nbQiD5ivyOVugDcX1aco4r0P9GFsZCxYz EMpHQVyRK6PlbaJMowDlRlEqQS/1R9CX/qGO9bodlEP9GNUhrVQhK6Ie7zLEtR4dlRDMEzw hCpLhXB6VU9p4caJnJFhA== X-UI-Out-Filterresults: notjunk:1; V01:K0:sA40HkS2yWM=:KGJ7CgKZCPvOWw1hqI0tD5 SeicW1Wp2ssaB52zpXFkoW8X2JUHJnA/52a+pWbaweM7ocSQts5oG3gyHwT3qXXtS2E+LTYFl gapm2Bl7Njn37uTuIpD2b0nY7d10p5ti0vrqEfJlMeFxdRJ/wLPYJ/O2jr1I5JrnDWI6yITEr G8DVLWxPzrNEmwtGxA7wCYffy49UCxeNt0pRXvH7UcnHSlmd8lYTCvx6xPPA4xP6rhKO8eYpW 0uMTS+qseMy6w1HNt2rT010cO47x80mD3D1SevlzSPizN7K0PBCEbjmaz9Egy1Cc0RKxbndvA j52+0tmF4ZzKLy6j8H161RwFLt1nY8RcTIZyoPZJHjRmiFn7S/9aRjM5aGnEVdkIC+veCXNTi vmqLv/Doh7e3+Vqh1QoBrpVon7QpHIIyJI6zlQheRvJGk4NVxhAlWLlwPoXfCC0jWyOM7v/9o o0fdsHOC7HEJk6RyWIg7hTL/KTnJ3X6Oc8g6FXmeul965opVzj3rBj0aoj3wIaaZ9ybzE1lUr 7jQGQuveZpG5Bq25sx2lO4SB0nQ2MAgl0Me16dmsuw3cCVnAme7v7126Deq3PrwmlB/8hDUGS 4l4oq7czdGgJfmDwHJliSAzSAxyyLJIfmhxVamYp8QcXAMx9NoRzZ37nnd9oIU+QTCP8JlfOC yjXxrIGWEvYhMoGDzUgGe6O1Uo05I/gkbdssyyu5W3Qlpco2AQ7wPo80cWPDcI7F6T7L2BNnK ICZt4sfpWkuz1qeSRtsdhWQylE8MkCrLqVMLag== Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org gcc-8 has a new warning that detects overlapping input and output arguments in memcpy(). It triggers for sit_init_net() calling ipip6_tunnel_clone_6rd(), which is actually correct: net/ipv6/sit.c: In function 'sit_init_net': net/ipv6/sit.c:192:3: error: 'memcpy' source argument is the same as destination [-Werror=restrict] The problem here is that the logic detecting the memcpy() arguments finds them to be the same, but the conditional that tests for the input and output of ipip6_tunnel_clone_6rd() to be identical is not a compile-time constant. We know that netdev_priv(t->dev) is the same as t for a tunnel device, and comparing "dev" directly here lets the compiler figure out as well that 'dev == sitn->fb_tunnel_dev' when called from sit_init_net(), so it no longer warns. This code is old, so Cc stable to make sure that we don't get the warning for older kernels built with new gcc. Cc: stable@vger.kernel.org Cc: Martin Sebor Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83456 Signed-off-by: Arnd Bergmann --- net/ipv6/sit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.9.0 diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c index 3873d3877135..3a1775a62973 100644 --- a/net/ipv6/sit.c +++ b/net/ipv6/sit.c @@ -182,7 +182,7 @@ static void ipip6_tunnel_clone_6rd(struct net_device *dev, struct sit_net *sitn) #ifdef CONFIG_IPV6_SIT_6RD struct ip_tunnel *t = netdev_priv(dev); - if (t->dev == sitn->fb_tunnel_dev) { + if (dev == sitn->fb_tunnel_dev) { ipv6_addr_set(&t->ip6rd.prefix, htonl(0x20020000), 0, 0, 0); t->ip6rd.relay_prefix = 0; t->ip6rd.prefixlen = 16;