Skip to content

Commit 28898e2

Browse files
committed
sysctl: move security keys sysctl registration to its own file
The security keys sysctls are already declared on its own file, just move the sysctl registration to its own file to help avoid merge conflicts on sysctls.c, and help with clearing up sysctl.c further. This creates a small penalty of 23 bytes: ./scripts/bloat-o-meter vmlinux.1 vmlinux.2 add/remove: 2/0 grow/shrink: 0/1 up/down: 49/-26 (23) Function old new delta init_security_keys_sysctls - 33 +33 __pfx_init_security_keys_sysctls - 16 +16 sysctl_init_bases 85 59 -26 Total: Before=21256937, After=21256960, chg +0.00% But soon we'll be saving tons of bytes anyway, as we modify the sysctl registrations to use ARRAY_SIZE and so we get rid of all the empty array elements so let's just clean this up now. Reviewed-by: Paul Moore <paul@paul-moore.com> Acked-by: Jarkko Sakkinen <jarkko@kernel.org> Acked-by: David Howells <dhowells@redhat.com> Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
1 parent 861dc0b commit 28898e2

3 files changed

Lines changed: 7 additions & 7 deletions

File tree

include/linux/key.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -490,9 +490,6 @@ do { \
490490
rcu_assign_pointer((KEY)->payload.rcu_data0, (PAYLOAD)); \
491491
} while (0)
492492

493-
#ifdef CONFIG_SYSCTL
494-
extern struct ctl_table key_sysctls[];
495-
#endif
496493
/*
497494
* the userspace interface
498495
*/

kernel/sysctl.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2322,10 +2322,6 @@ static struct ctl_table vm_table[] = {
23222322
int __init sysctl_init_bases(void)
23232323
{
23242324
register_sysctl_init("kernel", kern_table);
2325-
#ifdef CONFIG_KEYS
2326-
register_sysctl_init("kernel/keys", key_sysctls);
2327-
#endif
2328-
23292325
register_sysctl_init("vm", vm_table);
23302326

23312327
return 0;

security/keys/sysctl.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,10 @@ struct ctl_table key_sysctls[] = {
6868
#endif
6969
{ }
7070
};
71+
72+
static int __init init_security_keys_sysctls(void)
73+
{
74+
register_sysctl_init("kernel/keys", key_sysctls);
75+
return 0;
76+
}
77+
early_initcall(init_security_keys_sysctls);

0 commit comments

Comments
 (0)