Re: [PATCH v5 5/8] net: Remove ctl_table sentinel elements from several networking subsystems

Sabrina Dubroca
2024-04-26T15:13:59Z

2024-04-26, 12:46:57 +0200, Joel Granados via B4 Relay wrote:
> diff --git a/net/smc/smc_sysctl.c b/net/smc/smc_sysctl.c
> index a5946d1b9d60..bd0b7e2f8824 100644
> --- a/net/smc/smc_sysctl.c
> +++ b/net/smc/smc_sysctl.c
> @@ -90,7 +90,6 @@ static struct ctl_table smc_table[] = {
> .extra1 = &conns_per_lgr_min,
> .extra2 = &conns_per_lgr_max,
> },
> - { }
> };

There's an ARRAY_SIZE(smc_table) - 1 in smc_sysctl_net_init, shouldn't
the -1 be removed like you did in other patches?

int __net_init smc_sysctl_net_init(struct net *net)
{
struct ctl_table *table;

table = smc_table;
if (!net_eq(net, &init_net)) {
int i;

table = kmemdup(table, sizeof(smc_table), GFP_KERNEL);
if (!table)
goto err_alloc;

for (i = 0; i < ARRAY_SIZE(smc_table) - 1; i++)
table[i].data += (void *)net - (void *)&init_net;
}

net->smc.smc_hdr = register_net_sysctl_sz(net, "net/smc", table,
ARRAY_SIZE(smc_table));
[...]

--
Sabrina