Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp1368468ybk; Sun, 10 May 2020 14:53:13 -0700 (PDT) X-Google-Smtp-Source: APiQypIuvoDxppX7614Tw0VZL4PmQHt782NFApfckTjm/ETI24lR0N1Ok4pCU5FsM/fO+MzQB8/d X-Received: by 2002:aa7:dc48:: with SMTP id g8mr11003510edu.33.1589147592963; Sun, 10 May 2020 14:53:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589147592; cv=none; d=google.com; s=arc-20160816; b=CmlbuO2ruZO2KNleH6ZH0TnOIz0gxiPHJ5YQ+a95JSz8GK7a1TwdXDqJYJwr7Iqn0V yyKoei9S58yd/hUEVfAAwD2kKK08Lq56uYudy99D/zFdW4FLVSzWlOE+I5GLgG50HzoG BBwcKHQa40WIcGy573ZWlD5ws4nRQisdHzoFT5/o6k+5bsgaJWjyoURRXIH/3jx9g8FB Txgf/iLZepvJ+UsbRR5GdFgWrGWF+lMiq1/IZqQRUBDYpeXoQQ8EdkSDdMIb6mwbdOS1 +UXwOtaglAbltrlaLyZnKkPTnJH4BiIU2D7q+zj/rdTowidScFQzv25M5AlePfXi3tNm otrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=FYrO+DG2BUu0al6vV12Lrn4AMeReOWOSMUHV3gWDSrQ=; b=hzACNHqFFdj16LdIyD6movdXe0oL+mZMshTIaRQfSC7KIrmKikd0sXHP81WGToHKY/ Lfju9toOGAywOhkGchRHKh6GWCCWhp/At0iLszFuv2WUPu9YIE8Z/nkXb4U10yL3NWTq jLkS25QdpItPKzy5ECMDpBztdEif/Prfuh0PW6cT0tlPzSPE3qjT4Z/fZklRnQf3i/bu v7uVhaEn3TrInBO3mb/xPCJ2kyRDvIISsEBWIgI1/4xQrtYVhSi9840jXl05ERjAYBIX p4r/NntwE/o4n8OQIOh3uYrFsjiHHuikCKw+vH+57m5haWbWs2XsISXvDQkrYPZPDa0h Kt1w== 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 h4si5416236edn.445.2020.05.10.14.52.36; Sun, 10 May 2020 14:53:12 -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 S1729428AbgEJVsd (ORCPT + 99 others); Sun, 10 May 2020 17:48:33 -0400 Received: from correo.us.es ([193.147.175.20]:59082 "EHLO mail.us.es" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729327AbgEJVsd (ORCPT ); Sun, 10 May 2020 17:48:33 -0400 Received: from antivirus1-rhel7.int (unknown [192.168.2.11]) by mail.us.es (Postfix) with ESMTP id B9438FB452 for ; Sun, 10 May 2020 23:48:31 +0200 (CEST) Received: from antivirus1-rhel7.int (localhost [127.0.0.1]) by antivirus1-rhel7.int (Postfix) with ESMTP id AA97211540E for ; Sun, 10 May 2020 23:48:31 +0200 (CEST) Received: by antivirus1-rhel7.int (Postfix, from userid 99) id 93D994E0C7; Sun, 10 May 2020 23:48:31 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on antivirus1-rhel7.int X-Spam-Level: X-Spam-Status: No, score=-108.2 required=7.5 tests=ALL_TRUSTED,BAYES_50, SMTPAUTH_US2,USER_IN_WHITELIST autolearn=disabled version=3.4.1 Received: from antivirus1-rhel7.int (localhost [127.0.0.1]) by antivirus1-rhel7.int (Postfix) with ESMTP id 8FC092040D; Sun, 10 May 2020 23:48:29 +0200 (CEST) Received: from 192.168.1.97 (192.168.1.97) by antivirus1-rhel7.int (F-Secure/fsigk_smtp/550/antivirus1-rhel7.int); Sun, 10 May 2020 23:48:29 +0200 (CEST) X-Virus-Status: clean(F-Secure/fsigk_smtp/550/antivirus1-rhel7.int) Received: from us.es (unknown [90.77.255.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: 1984lsi) by entrada.int (Postfix) with ESMTPSA id 5D88842EF4E1; Sun, 10 May 2020 23:48:29 +0200 (CEST) Date: Sun, 10 May 2020 23:48:29 +0200 X-SMTPAUTHUS: auth mail.us.es From: Pablo Neira Ayuso To: Arnd Bergmann Cc: linux-kernel@vger.kernel.org, Jozsef Kadlecsik , Florian Westphal , "David S. Miller" , Jakub Kicinski , Jeremy Sowden , Li RongQing , Joe Perches , Thomas Gleixner , Jules Irenge , Dirk Morris , netfilter-devel@vger.kernel.org, coreteam@netfilter.org, netdev@vger.kernel.org Subject: Re: [PATCH 06/15] netfilter: conntrack: avoid gcc-10 zero-length-bounds warning Message-ID: <20200510214829.GA9032@salvia> References: <20200430213101.135134-1-arnd@arndb.de> <20200430213101.135134-7-arnd@arndb.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200430213101.135134-7-arnd@arndb.de> User-Agent: Mutt/1.10.1 (2018-07-13) X-Virus-Scanned: ClamAV using ClamSMTP 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:48PM +0200, Arnd Bergmann wrote: > gcc-10 warns around a suspicious access to an empty struct member: > > net/netfilter/nf_conntrack_core.c: In function '__nf_conntrack_alloc': > net/netfilter/nf_conntrack_core.c:1522:9: warning: array subscript 0 is outside the bounds of an interior zero-length array 'u8[0]' {aka 'unsigned char[0]'} [-Wzero-length-bounds] > 1522 | memset(&ct->__nfct_init_offset[0], 0, > | ^~~~~~~~~~~~~~~~~~~~~~~~~~ > In file included from net/netfilter/nf_conntrack_core.c:37: > include/net/netfilter/nf_conntrack.h:90:5: note: while referencing '__nfct_init_offset' > 90 | u8 __nfct_init_offset[0]; > | ^~~~~~~~~~~~~~~~~~ > > The code is correct but a bit unusual. Rework it slightly in a way that > does not trigger the warning, using an empty struct instead of an empty > array. There are probably more elegant ways to do this, but this is the > smallest change. Applied, thanks.