lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201102140808.54c156fa@kicinski-fedora-PC1C0HJN.hsd1.ca.comcast.net>
Date:   Mon, 2 Nov 2020 14:08:08 -0800
From:   Jakub Kicinski <kuba@...nel.org>
To:     Vladimir Oltean <vladimir.oltean@....com>
Cc:     Pujin Shi <shipujin.t@...il.com>,
        "David S . Miller" <davem@...emloft.net>,
        Microchip Linux Driver Support <UNGLinuxDriver@...rochip.com>,
        Claudiu Manoil <claudiu.manoil@....com>,
        Alexandre Belloni <alexandre.belloni@...tlin.com>,
        Xiaoliang Yang <xiaoliang.yang_1@....com>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] net: ethernet: mscc: fix missing brace warning for old
 compilers

On Mon, 2 Nov 2020 13:56:55 +0000 Vladimir Oltean wrote:
> On Mon, Nov 02, 2020 at 09:41:36PM +0800, Pujin Shi wrote:
> > For older versions of gcc, the array = {0}; will cause warnings:
> > 
> > drivers/net/ethernet/mscc/ocelot_vcap.c: In function 'is1_entry_set':
> > drivers/net/ethernet/mscc/ocelot_vcap.c:755:11: warning: missing braces around initializer [-Wmissing-braces]
> >     struct ocelot_vcap_u16 etype = {0};
> >            ^
> > drivers/net/ethernet/mscc/ocelot_vcap.c:755:11: warning: (near initialization for 'etype.value') [-Wmissing-braces]
> > 
> > 1 warnings generated
> > 
> > Fixes: 75944fda1dfe ("net: mscc: ocelot: offload ingress skbedit and vlan actions to VCAP IS1")
> > Signed-off-by: Pujin Shi <shipujin.t@...il.com>
> > ---
> >  drivers/net/ethernet/mscc/ocelot_vcap.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/net/ethernet/mscc/ocelot_vcap.c b/drivers/net/ethernet/mscc/ocelot_vcap.c
> > index d8c778ee6f1b..b96eab4583e7 100644
> > --- a/drivers/net/ethernet/mscc/ocelot_vcap.c
> > +++ b/drivers/net/ethernet/mscc/ocelot_vcap.c
> > @@ -752,7 +752,7 @@ static void is1_entry_set(struct ocelot *ocelot, int ix,
> >  					     dport);
> >  		} else {
> >  			/* IPv4 "other" frame */
> > -			struct ocelot_vcap_u16 etype = {0};
> > +			struct ocelot_vcap_u16 etype = {};
> >  
> 
> Sorry, I don't understand what the problem is, or why your patch fixes
> it. What version of gcc are you testing with?

Old GCC does not like the 0, if the members of struct are not scalars.

struct ocelot_vcap_u16 {                                                        
        u8 value[2];                                                            
        u8 mask[2];                                                             
};

In this case the first member is an array.

It wants us to add another curly brace:

struct ocelot_vcap_u16 etype = {{0}};

... or we can just skip the 0.

That's just FWIW. I don't remember which versions of GCC behave like
that, I just know we get a constant stream of this sort of fixes.
I think clang may generate a similar warning.

Pujin, please specify the version of GCC you're using and repost.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ