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]
Date:   Mon, 20 Sep 2021 11:08:53 +0200
From:   Davide Caratti <dcaratti@...hat.com>
To:     "Russell King (Oracle)" <rmk+kernel@...linux.org.uk>
Cc:     "David S. Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>,
        Jamal Hadi Salim <jhs@...atatu.com>,
        Cong Wang <xiyou.wangcong@...il.com>,
        Jiri Pirko <jiri@...nulli.us>,
        Marcelo Ricardo Leitner <marcelo.leitner@...il.com>,
        netdev@...r.kernel.org
Subject: Re: [PATCH net] net: sched: fix initialiser warning in sch_frag.c

On Sun, Sep 19, 2021 at 11:40:33PM +0100, Russell King (Oracle) wrote:
> Debian gcc 10.2.1 complains thusly:
> 
> net/sched/sch_frag.c:93:10: warning: missing braces around initializer [-Wmissing-braces]
>    struct rtable sch_frag_rt = { 0 };
>           ^
> net/sched/sch_frag.c:93:10: warning: (near initialization for 'sch_frag_rt.dst') [-Wmissing-braces]
> 
> Fix it by removing the unnecessary '0' initialiser, leaving the
> braces.

hello Russell, thanks a lot for reporting!
 
> diff --git a/net/sched/sch_frag.c b/net/sched/sch_frag.c
> index 8c06381391d6..ab359d63287c 100644
> --- a/net/sched/sch_frag.c
> +++ b/net/sched/sch_frag.c
> @@ -90,7 +90,7 @@ static int sch_fragment(struct net *net, struct sk_buff *skb,
>  	}
>  
>  	if (skb_protocol(skb, true) == htons(ETH_P_IP)) {
> -		struct rtable sch_frag_rt = { 0 };
> +		struct rtable sch_frag_rt = { };

this surely fixes the -Wmissing-braces, but then -Wpedantic
would complain about usage of GNU extension (I just tried on godbolt
with x86_64 gcc 11.2):

warning: ISO C forbids empty initializer braces [-Wpedantic]

While we are fixing this, probably the best thing is to initialize the
'dst' struct member  to 0: in my understanding this should be sufficient
to let the compiler fill all the struct members with 0.

Oh, and I might have inserted a similar thing in openvswitch kernel
module (see [1]), if you agree I will send a patch that fixes this as
well. WDYT?

-- 
davide

[1] https://lore.kernel.org/netdev/80dbe764b5ae660bba3cf6edcb045a74b0f85853.1618844973.git.dcaratti@redhat.com/

Powered by blists - more mailing lists