Skip to content

Commit

Permalink
vrf: Update to register_net_sysctl_sz
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Joel Granados authored and Luis Chamberlain committed Aug 15, 2023
1 parent c899710 commit 3ca9aa7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/net/vrf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 3ca9aa7

Please sign in to comment.