Re: [PATCH net-next v2] geneve: Use empty braces for addr6 initializer

From: Joe Perches
Date: Fri Nov 16 2018 - 21:33:46 EST


On Fri, 2018-11-16 at 08:37 -0700, Nathan Chancellor wrote:
> On Fri, Nov 16, 2018 at 03:04:32PM +0100, Stefano Brivio wrote:
> > On Mon, 12 Nov 2018 23:11:47 -0700
> > Nathan Chancellor <natechancellor@xxxxxxxxx> wrote:
> >
> > > Clang warns:
> > >
> > > drivers/net/geneve.c:428:29: error: suggest braces around initialization
> > > of subobject [-Werror,-Wmissing-braces]
> > > struct in6_addr addr6 = { 0 };
> > > ^
> > > {}
> > >
> > > Most initializations of structs in the kernel seem to use this format.
[]
> > So { { { 0 } } } seems to be the safest option. We could go with static
> > but it looks even uglier to me.
> >
> > Joe, suggestions?

If this is really an issue, I don't know why the other uses
haven't been reported. Perhaps change the rest of them too?

$ git grep -P "struct\s+in6_addr\s+\w+\s*=\s*{\s*}"
include/net/ip6_fib.h: struct in6_addr in6_zero = {};
include/trace/events/fib6.h: struct in6_addr in6_zero = {};
net/6lowpan/iphc.c: struct in6_addr network_pfx = {};
net/6lowpan/iphc.c: struct in6_addr tmp = {};
net/6lowpan/iphc.c: struct in6_addr tmp = {};
net/6lowpan/iphc.c: struct in6_addr tmp = {};
net/6lowpan/iphc.c: struct in6_addr tmp = {};