From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Ahern Subject: Re: [PATCH ipsec] net: xfrm: pass constant family to nf_hook function Date: Fri, 21 Sep 2018 08:54:21 -0700 Message-ID: <299db7b3-dc90-18b6-759e-08d36eed3539@gmail.com> References: <20180921103541.8812-1-fw@strlen.de> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit To: Florian Westphal , netdev@vger.kernel.org Return-path: Received: from mail-pl1-f196.google.com ([209.85.214.196]:38691 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727392AbeIUVny (ORCPT ); Fri, 21 Sep 2018 17:43:54 -0400 Received: by mail-pl1-f196.google.com with SMTP id u11-v6so6153687plq.5 for ; Fri, 21 Sep 2018 08:54:25 -0700 (PDT) In-Reply-To: <20180921103541.8812-1-fw@strlen.de> Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: On 9/21/18 3:35 AM, Florian Westphal wrote: > Unfortunately some versions of gcc emit following warning: > linux/compiler.h:252:20: warning: array subscript is above array bounds [-Warray-bounds] > hook_head = rcu_dereference(net->nf.hooks_arp[hook]); > ^~~~~~~~~~~~~~~~~~~~~ > xfrm_output_resume passes non-const 'pf' argument so compiler can't know > that the affected statement above will never be executed (we only > pass either NFPROTO_IPV4 or NFPROTO_IPV6), this change makes this > explicit. > > Another solution would be to increase hooks_arp[] size, but that > increases struct net size needlesly. > > Reported-by: David Ahern > Signed-off-by: Florian Westphal > --- > David, i hope this will silence the warning, would be nice > if you could test it. I still the warning. > > I don't really like this patch, but I see no better solution > expect needless increase of hooks_arp[]. > > Any other idea? > I don't have any time in the next week to look into it. Sounds like you are not able to reproduce the output. It just debian stretch and gcc version 6.3.0 20170516 (Debian 6.3.0-18+deb9u1).