[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <063D6719AE5E284EB5DD2968C1650D6DD0089A35@AcuExch.aculab.com>
Date: Wed, 4 Oct 2017 14:12:24 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Craig Gallek' <kraigatgoog@...il.com>,
Jesper Dangaard Brouer <brouer@...hat.com>
CC: Alexei Starovoitov <ast@...com>,
Daniel Borkmann <daniel@...earbox.net>,
"David S . Miller" <davem@...emloft.net>,
Chonggang Li <chonggangli@...gle.com>,
netdev <netdev@...r.kernel.org>, Eric Leblond <eric@...it.org>,
"Wangnan (F)" <wangnan0@...wei.com>
Subject: RE: [PATCH net-next v2 1/2] libbpf: parse maps sections of varying
size
From: Craig Gallek
> Sent: 04 October 2017 14:58
> >> + obj->maps[map_idx].def = *def;
> >
> > I'm not too happy/comfortable with this way of copying the memory of
> > "def" (the type-cased struct bpf_map_def). I guess it works, and is
> > part of the C-standard(?).
>
> I believe this is a C++-ism. I'm not sure if it was pulled into the
> C99 standard or if it's just a gcc 'feature' now. I kept it because
> it was in the initial code, but I'm happy to do an explicit copy for
> v3 if that looks better.
Structure copies have been valid C for ages.
Annoyingly gcc will call memcpy() directly (not a 'private' function).
David
Powered by blists - more mailing lists