lkml.org 
[lkml]   [2024]   [Apr]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v5 1/8] net: Remove the now superfluous sentinel elements from ctl_table array
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


\
 
 \ /
  Last update: 2024-04-29 10:54    [W:0.147 / U:0.212 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site