Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp625580ybz; Fri, 1 May 2020 05:43:37 -0700 (PDT) X-Google-Smtp-Source: APiQypIC93Ra+cUW0j9zGQVy/KRvH3/Dy9Uk6+keiZDrfpzWw5IdqzEXju6bS2OKY0GJ++WSL7JL X-Received: by 2002:a05:6402:2076:: with SMTP id bd22mr3408506edb.334.1588337017730; Fri, 01 May 2020 05:43:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588337017; cv=none; d=google.com; s=arc-20160816; b=Frlq1yau3ITD5BikJo9fDrJxQYLnIPaadfC9aD5V8thj2+0lC76m6eraikFFPBeZx3 izRAlLBtLzOIPNDUN+9uI0ga1Iv4Jt9zwLhaFShGKvpr9g3uGAzszLradc1T+svqeqDy 05FrbeL83Uv/FRP6IWyjm4k4Vs2kPfsSYm6rsUbxElPQe9Wc477YILrrZdWSwrKZOHCC 5N6z/SpRtjHu74O5ePyxBSkpJzqnDmRH3/oQ4Bg/h4EbozBo6OZx4HA1nONTJ8uXMVWX Ez8SuOq8pRuNAmn21uj0MMAS9DKp7OaYdxyF8oCdB2h1pz/qhP5tCJvnhlZE2rR554PM Nyig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=b2CVN5JC8FoexUeZ4KplUIJ1oWh1DKyAJbjpFC6ijsE=; b=yuwt8V0Q3oYM3QtVV1GaxpQwc+rj7x5G3OQZ+I6CNQZfaxwtGPMJlKxnblUVIGYDKx OGl7kpjXkC9tjXLcALhx9FidupmWFgZ48KC0F528P/utblmWnQEhZv2imyQV9Z0/QLLR A9GqxVlcnsG9gGwJNyuaUWJO0xDwpTlME7h84VMbBIKrOWebcXu/430gKNT8CW8XoPb1 wvEZYMJtkh3+4TjERK0LaIjTKKU1rZK1LultIaL4OEH6rt/RC5v5gbtd69McaPDEr7vM 0umYheNv2furKtPXdDwdqpd/gvnkUggzwyvkWfy8wFCv7uJzgL1xiWd067Hn46ULvwYB 2X9g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m14si1779349ejb.514.2020.05.01.05.43.14; Fri, 01 May 2020 05:43:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728781AbgEAMlr (ORCPT + 99 others); Fri, 1 May 2020 08:41:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1728712AbgEAMlr (ORCPT ); Fri, 1 May 2020 08:41:47 -0400 X-Greylist: delayed 4393 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Fri, 01 May 2020 05:41:47 PDT Received: from smtp.tuxdriver.com (tunnel92311-pt.tunnel.tserv13.ash1.ipv6.he.net [IPv6:2001:470:7:9c9::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 1C41CC061A0C; Fri, 1 May 2020 05:41:47 -0700 (PDT) Received: from [107.15.85.130] (helo=localhost) by smtp.tuxdriver.com with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1jUTq8-0005B2-96; Fri, 01 May 2020 07:28:26 -0400 Date: Fri, 1 May 2020 07:28:14 -0400 From: Neil Horman To: Arnd Bergmann Cc: linux-kernel@vger.kernel.org, "David S. Miller" , Jakub Kicinski , Ido Schimmel , Jiri Pirko , Joe Perches , netdev@vger.kernel.org Subject: Re: [PATCH 07/15] drop_monitor: work around gcc-10 stringop-overflow warning Message-ID: <20200501112814.GA2175875@hmswarspite.think-freely.org> References: <20200430213101.135134-1-arnd@arndb.de> <20200430213101.135134-8-arnd@arndb.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200430213101.135134-8-arnd@arndb.de> X-Spam-Score: -2.9 (--) X-Spam-Status: No Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 30, 2020 at 11:30:49PM +0200, Arnd Bergmann wrote: > The current gcc-10 snapshot produces a false-positive warning: > > net/core/drop_monitor.c: In function 'trace_drop_common.constprop': > cc1: error: writing 8 bytes into a region of size 0 [-Werror=stringop-overflow=] > In file included from net/core/drop_monitor.c:23: > include/uapi/linux/net_dropmon.h:36:8: note: at offset 0 to object 'entries' with size 4 declared here > 36 | __u32 entries; > | ^~~~~~~ > > I reported this in the gcc bugzilla, but in case it does not get > fixed in the release, work around it by using a temporary variable. > > Fixes: 9a8afc8d3962 ("Network Drop Monitor: Adding drop monitor implementation & Netlink protocol") > Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94881 > Signed-off-by: Arnd Bergmann > --- > net/core/drop_monitor.c | 11 +++++++---- > 1 file changed, 7 insertions(+), 4 deletions(-) > > diff --git a/net/core/drop_monitor.c b/net/core/drop_monitor.c > index 8e33cec9fc4e..2ee7bc4c9e03 100644 > --- a/net/core/drop_monitor.c > +++ b/net/core/drop_monitor.c > @@ -213,6 +213,7 @@ static void sched_send_work(struct timer_list *t) > static void trace_drop_common(struct sk_buff *skb, void *location) > { > struct net_dm_alert_msg *msg; > + struct net_dm_drop_point *point; > struct nlmsghdr *nlh; > struct nlattr *nla; > int i; > @@ -231,11 +232,13 @@ static void trace_drop_common(struct sk_buff *skb, void *location) > nlh = (struct nlmsghdr *)dskb->data; > nla = genlmsg_data(nlmsg_data(nlh)); > msg = nla_data(nla); > + point = msg->points; > for (i = 0; i < msg->entries; i++) { > - if (!memcmp(&location, msg->points[i].pc, sizeof(void *))) { > - msg->points[i].count++; > + if (!memcmp(&location, &point->pc, sizeof(void *))) { > + point->count++; > goto out; > } > + point++; > } > if (msg->entries == dm_hit_limit) > goto out; > @@ -244,8 +247,8 @@ static void trace_drop_common(struct sk_buff *skb, void *location) > */ > __nla_reserve_nohdr(dskb, sizeof(struct net_dm_drop_point)); > nla->nla_len += NLA_ALIGN(sizeof(struct net_dm_drop_point)); > - memcpy(msg->points[msg->entries].pc, &location, sizeof(void *)); > - msg->points[msg->entries].count = 1; > + memcpy(point->pc, &location, sizeof(void *)); > + point->count = 1; > msg->entries++; > > if (!timer_pending(&data->send_timer)) { Acked-by: Neil Horman