networking: Update to register_net_sysctl_sz
authorJoel Granados <joel.granados@gmail.com>
Wed, 9 Aug 2023 10:50:03 +0000 (12:50 +0200)
committerLuis Chamberlain <mcgrof@kernel.org>
Tue, 15 Aug 2023 22:26:18 +0000 (15:26 -0700)
commitc899710fe7f9f24dd77135875f199359f7b8b774
tree096559bda97f2123d3a74b4557b6de3491a578cd
parent385a5dc9e578bdc43bf5196258f699f08612379b
networking: Update to register_net_sysctl_sz

Move from register_net_sysctl to register_net_sysctl_sz for all the
networking related files. Do this while making sure to mirror the NULL
assignments with a table_size of zero for the unprivileged users.

We need to move to the new function in preparation for when we change
SIZE_MAX to ARRAY_SIZE() in the register_net_sysctl macro. Failing to do
so would erroneously allow ARRAY_SIZE() to be called on a pointer. We
hold off the SIZE_MAX to ARRAY_SIZE change until we have migrated all
the relevant net sysctl registering functions to register_net_sysctl_sz
in subsequent commits.

An additional size function was added to the following files in order to
calculate the size of an array that is defined in another file:
    include/net/ipv6.h
    net/ipv6/icmp.c
    net/ipv6/route.c
    net/ipv6/sysctl_net_ipv6.c

Signed-off-by: Joel Granados <j.granados@samsung.com>
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
22 files changed:
include/net/ipv6.h
net/core/neighbour.c
net/core/sysctl_net_core.c
net/ieee802154/6lowpan/reassembly.c
net/ipv4/devinet.c
net/ipv4/ip_fragment.c
net/ipv4/route.c
net/ipv4/sysctl_net_ipv4.c
net/ipv4/xfrm4_policy.c
net/ipv6/addrconf.c
net/ipv6/icmp.c
net/ipv6/reassembly.c
net/ipv6/route.c
net/ipv6/sysctl_net_ipv6.c
net/ipv6/xfrm6_policy.c
net/mpls/af_mpls.c
net/mptcp/ctrl.c
net/rds/tcp.c
net/sctp/sysctl.c
net/smc/smc_sysctl.c
net/unix/sysctl_net_unix.c
net/xfrm/xfrm_sysctl.c