Skip to content

Commit

Permalink
seccomp: simplify sysctls with register_sysctl_init()
Browse files Browse the repository at this point in the history
register_sysctl_paths() is only needed if you have childs (directories)
with entries. Just use register_sysctl_init() as it also does the
kmemleak check for you.

Acked-by: Kees Cook <[email protected]>
Signed-off-by: Luis Chamberlain <[email protected]>
  • Loading branch information
mcgrof committed Apr 13, 2023
1 parent 98cfeb8 commit 02a6b45
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions kernel/seccomp.c
Original file line number Diff line number Diff line change
Expand Up @@ -2368,12 +2368,6 @@ static int seccomp_actions_logged_handler(struct ctl_table *ro_table, int write,
return ret;
}

static struct ctl_path seccomp_sysctl_path[] = {
{ .procname = "kernel", },
{ .procname = "seccomp", },
{ }
};

static struct ctl_table seccomp_sysctl_table[] = {
{
.procname = "actions_avail",
Expand All @@ -2392,14 +2386,7 @@ static struct ctl_table seccomp_sysctl_table[] = {

static int __init seccomp_sysctl_init(void)
{
struct ctl_table_header *hdr;

hdr = register_sysctl_paths(seccomp_sysctl_path, seccomp_sysctl_table);
if (!hdr)
pr_warn("sysctl registration failed\n");
else
kmemleak_not_leak(hdr);

register_sysctl_init("kernel/seccomp", seccomp_sysctl_table);
return 0;
}

Expand Down

0 comments on commit 02a6b45

Please sign in to comment.