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-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:

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

> +			(tbl + i)->data += (char *)net - (char *)&init_net;

                        tbl[i].data = ...

is more in line with other similar functions in the rest of net/


[...]
> 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?

-- 
Sabrina






[Index of Archives]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux