diff options
author | Joel Granados <joel.granados@gmail.com> | 2023-08-09 13:49:59 +0300 |
---|---|---|
committer | Luis Chamberlain <mcgrof@kernel.org> | 2023-08-16 01:26:17 +0300 |
commit | 3bc269cfd3e119be84b69d95aec3a9e147016bb2 (patch) | |
tree | a5f12d9ae0dcdf8150e3ff67a7c7573b0aefab14 /include/linux/sysctl.h | |
parent | 9edbfe92a0a1355bae1e47c8f542ac0d39f19f8c (diff) | |
download | linux-3bc269cfd3e119be84b69d95aec3a9e147016bb2.tar.xz |
sysctl: Add size arg to __register_sysctl_init
This commit adds table_size to __register_sysctl_init in preparation for
the removal of the sentinel elements in the ctl_table arrays (last empty
markers). And though we do *not* remove any sentinels in this commit, we
set things up by calculating the ctl_table array size with ARRAY_SIZE.
We add a table_size argument to __register_sysctl_init and modify the
register_sysctl_init macro to calculate the array size with ARRAY_SIZE.
The original callers do not need to be updated as they will go through
the new macro.
Signed-off-by: Joel Granados <j.granados@samsung.com>
Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
Diffstat (limited to 'include/linux/sysctl.h')
-rw-r--r-- | include/linux/sysctl.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h index b1168ae281c9..09d7429d67c0 100644 --- a/include/linux/sysctl.h +++ b/include/linux/sysctl.h @@ -236,8 +236,9 @@ void unregister_sysctl_table(struct ctl_table_header * table); extern int sysctl_init_bases(void); extern void __register_sysctl_init(const char *path, struct ctl_table *table, - const char *table_name); -#define register_sysctl_init(path, table) __register_sysctl_init(path, table, #table) + const char *table_name, size_t table_size); +#define register_sysctl_init(path, table) \ + __register_sysctl_init(path, table, #table, ARRAY_SIZE(table)) extern struct ctl_table_header *register_sysctl_mount_point(const char *path); void do_sysctl_args(void); |