]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
vrf: Update to register_net_sysctl_sz
authorJoel Granados <joel.granados@gmail.com>
Wed, 9 Aug 2023 10:50:04 +0000 (12:50 +0200)
committerLuis Chamberlain <mcgrof@kernel.org>
Tue, 15 Aug 2023 22:26:18 +0000 (15:26 -0700)
Move from register_net_sysctl to register_net_sysctl_sz and pass the
ARRAY_SIZE of the ctl_table array that was used to create the table
variable. 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. The actual change from SIZE_MAX to ARRAY_SIZE will take place
in subsequent commits.

Signed-off-by: Joel Granados <j.granados@samsung.com>
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
drivers/net/vrf.c

index bdb3a76a352e459f1d302652c1a9c95c8f31fbe3..f4c3df15a0e539deb4b8001c7d4560b38d9eaaca 100644 (file)
@@ -1979,7 +1979,8 @@ static int vrf_netns_init_sysctl(struct net *net, struct netns_vrf *nn_vrf)
        /* init the extra1 parameter with the reference to current netns */
        table[0].extra1 = net;
 
-       nn_vrf->ctl_hdr = register_net_sysctl(net, "net/vrf", table);
+       nn_vrf->ctl_hdr = register_net_sysctl_sz(net, "net/vrf", table,
+                                                ARRAY_SIZE(vrf_table));
        if (!nn_vrf->ctl_hdr) {
                kfree(table);
                return -ENOMEM;