[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1409841129.26422.117.camel@edumazet-glaptop2.roam.corp.google.com>
Date: Thu, 04 Sep 2014 07:32:09 -0700
From: Eric Dumazet <eric.dumazet@...il.com>
To: David Laight <David.Laight@...LAB.COM>
Cc: Hannes Frederic Sowa <hannes@...essinduktion.org>,
Denis Kirjanov <kirjanov@...il.com>,
Alexei Starovoitov <alexei.starovoitov@...il.com>,
Daniel Borkmann <dborkman@...hat.com>,
Eric Dumazet <edumazet@...gle.com>,
Denis Kirjanov <kda@...ux-powerpc.org>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
Markos Chandras <markos.chandras@...tec.com>,
Martin Schwidefsky <schwidefsky@...ibm.com>
Subject: RE: [PATCH v2 net-next] net: filter: export pkt_type_offset() helper
On Thu, 2014-09-04 at 14:23 +0000, David Laight wrote:
> From: Eric Dumazet
> > On Thu, 2014-09-04 at 15:40 +0200, Hannes Frederic Sowa wrote:
> >
> > > The type does not matter at all. Actually I wanted to use an empty
> > > struct but was afraid it might not work on older compilers and didn't
> > > want to check that with each version.
> >
> >
> > It matters. Really.
> >
> > $ cat try.c
> > #include <stdio.h>
> >
> > struct S_int {
> > char a;
> > int offset[0];
> > char b:1;
> > };
> >
> > struct S_char {
> > char a;
> > char offset[0];
> > char b:1;
> > };
>
> Those are also both illegal C, zero sized arrays aren't allowed.
>
> David
This does not matter, we already use such constructs in the kernel.
Take a look at kmemcheck_bitfield_begin() for example.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists