LVS
lvs-devel
Google
 
Web LinuxVirtualServer.org

Re: [PATCH v5 1/8] net: Remove the now superfluous sentinel elements fro

To: Sabrina Dubroca <sd@xxxxxxxxxxxxxxx>
Subject: Re: [PATCH v5 1/8] net: Remove the now superfluous sentinel elements from ctl_table array
Cc: "David S. Miller" <davem@xxxxxxxxxxxxx>, Eric Dumazet <edumazet@xxxxxxxxxx>, Jakub Kicinski <kuba@xxxxxxxxxx>, Paolo Abeni <pabeni@xxxxxxxxxx>, Alexander Aring <alex.aring@xxxxxxxxx>, Stefan Schmidt <stefan@xxxxxxxxxxxxxxxxxx>, Miquel Raynal <miquel.raynal@xxxxxxxxxxx>, David Ahern <dsahern@xxxxxxxxxx>, Steffen Klassert <steffen.klassert@xxxxxxxxxxx>, Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>, Matthieu Baerts <matttbe@xxxxxxxxxx>, Mat Martineau <martineau@xxxxxxxxxx>, Geliang Tang <geliang@xxxxxxxxxx>, Remi Denis-Courmont <courmisch@xxxxxxxxx>, Allison Henderson <allison.henderson@xxxxxxxxxx>, David Howells <dhowells@xxxxxxxxxx>, Marc Dionne <marc.dionne@xxxxxxxxxxxx>, Marcelo Ricardo Leitner <marcelo.leitner@xxxxxxxxx>, Xin Long <lucien.xin@xxxxxxxxx>, Wenjia Zhang <wenjia@xxxxxxxxxxxxx>, Jan Karcher <jaka@xxxxxxxxxxxxx>, "D. Wythe" <alibuda@xxxxxxxxxxxxxxxxx>, Tony Lu <tonylu@xxxxxxxxxxxxxxxxx>, Wen Gu <guwen@xxxxxxxxxxxxxxxxx>, Trond Myklebust <trond.myklebust@xxxxxxxxxxxxxxx>, Anna Schumaker <anna@xxxxxxxxxx>, Chuck Lever <chuck.lever@xxxxxxxxxx>, Jeff Layton <jlayton@xxxxxxxxxx>, Neil Brown <neilb@xxxxxxx>, Olga Kornievskaia <kolga@xxxxxxxxxx>, Dai Ngo <Dai.Ngo@xxxxxxxxxx>, Tom Talpey <tom@xxxxxxxxxx>, Jon Maloy <jmaloy@xxxxxxxxxx>, Ying Xue <ying.xue@xxxxxxxxxxxxx>, Martin Schiller <ms@xxxxxxxxxx>, Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx>, Jozsef Kadlecsik <kadlec@xxxxxxxxxxxxx>, Florian Westphal <fw@xxxxxxxxx>, Roopa Prabhu <roopa@xxxxxxxxxx>, Nikolay Aleksandrov <razor@xxxxxxxxxxxxx>, Simon Horman <horms@xxxxxxxxxxxx>, Julian Anastasov <ja@xxxxxx>, Joerg Reuter <jreuter@xxxxxxxx>, Luis Chamberlain <mcgrof@xxxxxxxxxx>, Kees Cook <keescook@xxxxxxxxxxxx>, <netdev@xxxxxxxxxxxxxxx>, <linux-kernel@xxxxxxxxxxxxxxx>, <dccp@xxxxxxxxxxxxxxx>, <linux-wpan@xxxxxxxxxxxxxxx>, <mptcp@xxxxxxxxxxxxxxx>, <linux-hams@xxxxxxxxxxxxxxx>, <linux-rdma@xxxxxxxxxxxxxxx>, <rds-devel@xxxxxxxxxxxxxx>, <linux-afs@xxxxxxxxxxxxxxxxxxx>, <linux-sctp@xxxxxxxxxxxxxxx>, <linux-s390@xxxxxxxxxxxxxxx>, <linux-nfs@xxxxxxxxxxxxxxx>, <tipc-discussion@xxxxxxxxxxxxxxxxxxxxx>, <linux-x25@xxxxxxxxxxxxxxx>, <netfilter-devel@xxxxxxxxxxxxxxx>, <coreteam@xxxxxxxxxxxxx>, <bridge@xxxxxxxxxxxxxxx>, <lvs-devel@xxxxxxxxxxxxxxx>
From: Joel Granados <j.granados@xxxxxxxxxxx>
Date: Mon, 29 Apr 2024 14:33:15 +0200
On Mon, Apr 29, 2024 at 10:53:47AM +0200, Sabrina Dubroca wrote:
> 2024-04-26, 12:46:53 +0200, Joel Granados via B4 Relay wrote:
> > diff --git a/net/core/sysctl_net_core.c b/net/core/sysctl_net_core.c
> > index 6973dda3abda..a84690b13bb9 100644
> > --- a/net/core/sysctl_net_core.c
> > +++ b/net/core/sysctl_net_core.c
> [...]
> > @@ -723,12 +722,11 @@ static __net_init int sysctl_core_net_init(struct net 
> > *net)
> >             if (tbl == NULL)
> >                     goto err_dup;
> >  
> > -           for (tmp = tbl; tmp->procname; tmp++)
> > -                   tmp->data += (char *)net - (char *)&init_net;
> 
> Some coding style nits in case you re-post:
Thx. I will, so please scream if you see more issues.

> 
> > +           for (int i = 0; i < table_size; ++i)
> 
> move the declaration of int i out of the for (), it's almost never
> written this way (at least in networking)
done

> 
> > +                   (tbl + i)->data += (char *)net - (char *)&init_net;
> 
>                         tbl[i].data = ...
> 
> is more in line with other similar functions in the rest of net/
done

> 
> 
> [...]
> > diff --git a/net/mpls/af_mpls.c b/net/mpls/af_mpls.c
> > index 6dab883a08dd..ecc849678e7b 100644
> > --- a/net/mpls/af_mpls.c
> > +++ b/net/mpls/af_mpls.c
> [...]
> > @@ -2674,6 +2673,7 @@ static const struct ctl_table mpls_table[] = {
> >  
> >  static int mpls_net_init(struct net *net)
> >  {
> > +   size_t table_size = ARRAY_SIZE(mpls_table);
> 
> This table still has a {} as its final element. It should be gone too?
Now, how did that get away?  I'll run my coccinelle scripts once more to
make sure that I don't have more of these hiding in the shadows.

Thx for your feedback

Best

-- 

Joel Granados

Attachment: signature.asc
Description: PGP signature

<Prev in Thread] Current Thread [Next in Thread>