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]

 



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


[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux