mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
net: ipv{6,4}: Remove the now superfluous sentinel elements from ctl_table array
This commit comes at the tail end of a greater effort to remove the empty elements at the end of the ctl_table arrays (sentinels) which will reduce the overall build time size of the kernel and run time memory bloat by ~64 bytes per sentinel (further information Link : https://lore.kernel.org/all/ZO5Yx5JFogGi%2FcBo@bombadil.infradead.org/) * Remove sentinel element from ctl_table structs. * Remove the zeroing out of an array element (to make it look like a sentinel) in sysctl_route_net_init And ipv6_route_sysctl_init. This is not longer needed and is safe after commitc899710fe7("networking: Update to register_net_sysctl_sz") added the array size to the ctl_table registration. * Remove extra sentinel element in the declaration of devinet_vars. * Removed the "-1" in __devinet_sysctl_register, sysctl_route_net_init, ipv6_sysctl_net_init and ipv4_sysctl_init_net that adjusted for having an extra empty element when looping over ctl_table arrays * Replace the for loop stop condition in __addrconf_sysctl_register that tests for procname == NULL with one that depends on array size * Removing the unprivileged user check in ipv6_route_sysctl_init is safe as it is replaced by calling ipv6_route_sysctl_table_size; introduced in commitc899710fe7("networking: Update to register_net_sysctl_sz") * Use a table_size variable to keep the value of ARRAY_SIZE Signed-off-by: Joel Granados <j.granados@samsung.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
ce218712b0
commit
1c106eb01c
@@ -2520,7 +2520,7 @@ static int ipv4_doint_and_flush(struct ctl_table *ctl, int write,
|
||||
|
||||
static struct devinet_sysctl_table {
|
||||
struct ctl_table_header *sysctl_header;
|
||||
struct ctl_table devinet_vars[__IPV4_DEVCONF_MAX];
|
||||
struct ctl_table devinet_vars[IPV4_DEVCONF_MAX];
|
||||
} devinet_sysctl = {
|
||||
.devinet_vars = {
|
||||
DEVINET_SYSCTL_COMPLEX_ENTRY(FORWARDING, "forwarding",
|
||||
@@ -2583,7 +2583,7 @@ static int __devinet_sysctl_register(struct net *net, char *dev_name,
|
||||
if (!t)
|
||||
goto out;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(t->devinet_vars) - 1; i++) {
|
||||
for (i = 0; i < ARRAY_SIZE(t->devinet_vars); i++) {
|
||||
t->devinet_vars[i].data += (char *)p - (char *)&ipv4_devconf;
|
||||
t->devinet_vars[i].extra1 = p;
|
||||
t->devinet_vars[i].extra2 = net;
|
||||
@@ -2657,7 +2657,6 @@ static struct ctl_table ctl_forward_entry[] = {
|
||||
.extra1 = &ipv4_devconf,
|
||||
.extra2 = &init_net,
|
||||
},
|
||||
{ },
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user