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

Joel Granados <[email protected]>
Newsgroups org.kernel.vger.linux-x25,dev.linux.lists.bridge,dev.linux.lists.mptcp,org.kernel.vger.dccp,org.kernel.vger.linux-hams,org.kernel.vger.linux-kernel,org.kernel.vger.linux-nfs,org.kernel.vger.linux-rdma,org.kernel.vger.linux-s390,org.kernel.vger.linux-sctp,org.kernel.vger.linux-wpan,org.kernel.vger.lvs-devel,org.kernel.vger.netdev,org.kernel.vger.netfilter-devel
Message-ID <[email protected]>
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
signature.asc (application/pgp-signature, 659 B)
-----BEGIN PGP SIGNATURE-----

iQGzBAABCgAdFiEErkcJVyXmMSXOyyeQupfNUreWQU8FAmYvk4cACgkQupfNUreW
QU9RsQv8C71HsQc8Vg7luamuUmm0Not2QdsN7GJDowWizIp5iePr8Jrm0Hq4Rz0n
gUg/1uGHm+xIjZ5Aujscvqcy3CrS9vDrlHJfX+2BB5e5ZGOWBfxMJbTSjy4clUvh
kDrWEb8qKRjg6nnHgON0LMHY3lRPd5CPiDYaBu+9ZGgglD+QgFQRXTjLkRKUXACR
n7HsKeK2xWtWThEejoLQD69q+8yP6qeY2dIWUkQYAVcqRKeGO2UCfnTZxvPkRRbN
vNHyUo8XgVs+ZKRMhRBRfkGGNgAslX7kCyLdjhKpSclplQGj8N0MnVXQOiqzSliM
+RcpLFb/Wt11cE1Ww9/ujfJH5rlc5tYUnrR0VKN04J5lbyXE46nSGfOlw75dbabe
8tHH4PNWE3hDroaoscF1+uTc6G4Lkz+1DcUPtjbxdvYS4xv8klh7mtRNqLQhzOYb
yZ/3PmqjHaFZoxIjag3UtJWBjmG7n1p7E+WDd7Yu2bESLTvifEZ6zDWYBrEuHdJ9
mxZGDMB8
=LvuX
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.