@@ -90,7 +90,7 @@ static int sch_fragment(struct net *net, struct sk_buff *skb,}if(skb_protocol(skb,true)==htons(ETH_P_IP)){-structrtablesch_frag_rt={0};+structrtablesch_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/
@@ -90,7 +90,7 @@ static int sch_fragment(struct net *net, struct sk_buff *skb,}if(skb_protocol(skb,true)==htons(ETH_P_IP)){-structrtablesch_frag_rt={0};+structrtablesch_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?
ISO C may forbid it, but the kernel build uses -std=gnu89 - which is
c89 with GNU extensions. One of the GNU extensions is to allow the
empty initialiser, which means "initialise all members of this struct
to zero".
However, as I say, this was found using gcc 4.9.4 under 5.14, where
4.9.4 is a permissable compiler. However, under 5.15-rc it is no
longer so the patch should not be applied to development kernels.
It leaves the question open whether it should be fixed in stable or
not, since stable kernels _do_ permit gcc 4.9.4.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!