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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2024-04-29, 14:33:15 +0200, Joel Granados wrote:
> 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.

I've gone through the whole series and didn't see anything more.

> > > +		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.

I didn't spot any other with a dumb

    sed -n '<line>,^};/p' <file>

(with file/line produced by git grep 'struct ctl_table' -- net)


Thanks.

-- 
Sabrina






[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux