netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Phil Sutter <phil@nwl.cc>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [nf-next PATCH] netfilter: include: uapi: Use C99 flexible array member
Date: Fri, 17 Jul 2020 12:06:48 +0200	[thread overview]
Message-ID: <20200717100648.GE23632@orbyte.nwl.cc> (raw)
In-Reply-To: <20200715181433.GA17636@salvia>

Hi Pablo,

On Wed, Jul 15, 2020 at 08:14:33PM +0200, Pablo Neira Ayuso wrote:
> On Mon, Jul 13, 2020 at 01:15:52PM +0200, Phil Sutter wrote:
> [...]
> > Avoid this warning by declaring 'entries' as an ISO C99 flexible array
> > member. This makes gcc aware of the intended use and enables sanity
> > checking as described in:
> > https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
> > 
> > Signed-off-by: Phil Sutter <phil@nwl.cc>
> > ---
> >  include/uapi/linux/netfilter_ipv4/ip_tables.h  | 2 +-
> >  include/uapi/linux/netfilter_ipv6/ip6_tables.h | 2 +-
> >  2 files changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/include/uapi/linux/netfilter_ipv4/ip_tables.h b/include/uapi/linux/netfilter_ipv4/ip_tables.h
> > index 50c7fee625ae9..1a298cc7a29c1 100644
> > --- a/include/uapi/linux/netfilter_ipv4/ip_tables.h
> > +++ b/include/uapi/linux/netfilter_ipv4/ip_tables.h
> > @@ -203,7 +203,7 @@ struct ipt_replace {
> >  	struct xt_counters __user *counters;
> >  
> >  	/* The entries (hang off end: not really an array). */
> > -	struct ipt_entry entries[0];
> > +	struct ipt_entry entries[];
> 
> arpt_replace uses this idiom too.

Oh, indeed. I focussed on those cases gcc complained about when
compiling iptables. Grepping for '\[0\]' in all of
include/uapi/linux/netfilter* reveals a few more cases. Do you think
it's worth "fixing" those as well?

Thanks, Phil

  reply	other threads:[~2020-07-17 10:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-13 11:15 [nf-next PATCH] netfilter: include: uapi: Use C99 flexible array member Phil Sutter
2020-07-15 18:14 ` Pablo Neira Ayuso
2020-07-17 10:06   ` Phil Sutter [this message]
2020-07-17 10:20     ` Pablo Neira Ayuso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200717100648.GE23632@orbyte.nwl.cc \
    --to=phil@nwl.cc \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).