Skip to content

Commit

Permalink
apparmor: simplify sysctls with register_sysctl_init()
Browse files Browse the repository at this point in the history
Using register_sysctl_paths() is really only needed if you have
subdirectories with entries. We can use the simple register_sysctl()
instead.

Acked-by: John Johansen <[email protected]>
Reviewed-by: Georgia Garcia <[email protected]>
Signed-off-by: Luis Chamberlain <[email protected]>
  • Loading branch information
mcgrof committed Apr 13, 2023
1 parent 228b09d commit 9620095
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions security/apparmor/lsm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1764,11 +1764,6 @@ static int apparmor_dointvec(struct ctl_table *table, int write,
return proc_dointvec(table, write, buffer, lenp, ppos);
}

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

static struct ctl_table apparmor_sysctl_table[] = {
{
.procname = "unprivileged_userns_apparmor_policy",
Expand All @@ -1790,8 +1785,7 @@ static struct ctl_table apparmor_sysctl_table[] = {

static int __init apparmor_init_sysctl(void)
{
return register_sysctl_paths(apparmor_sysctl_path,
apparmor_sysctl_table) ? 0 : -ENOMEM;
return register_sysctl("kernel", apparmor_sysctl_table) ? 0 : -ENOMEM;
}
#else
static inline int apparmor_init_sysctl(void)
Expand Down

0 comments on commit 9620095

Please sign in to comment.