[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1409841233.23465.22.camel@localhost>
Date: Thu, 04 Sep 2014 16:33:53 +0200
From: Hannes Frederic Sowa <hannes@...essinduktion.org>
To: Eric Dumazet <eric.dumazet@...il.com>
Cc: David Laight <David.Laight@...LAB.COM>,
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 Do, 2014-09-04 at 07:32 -0700, Eric Dumazet wrote:
> 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.
Which btw. also uses int, which might change alignment of structures.
--
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