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

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

 



On Fri, Apr 26, 2024 at 05:13:37PM +0200, Sabrina Dubroca wrote:
> 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++)
This is a very good catch !!!! Thx a lot!! I'll put this into my V6.

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

-- 

Joel Granados

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Networking Development]     [Linux OMAP]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     SCTP

  Powered by Linux