seccomp: Constify sysctl subhelpers
authorKees Cook <keescook@chromium.org>
Wed, 8 May 2024 17:13:41 +0000 (10:13 -0700)
committerKees Cook <keescook@chromium.org>
Wed, 8 May 2024 19:50:40 +0000 (12:50 -0700)
The read_actions_logged() and write_actions_logged() helpers called by the
sysctl proc handler seccomp_actions_logged_handler() are already expecting
their sysctl table argument to be read-only. Actually mark the argument
as const in preparation[1] for global constification of the sysctl tables.

Suggested-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://lore.kernel.org/lkml/20240423-sysctl-const-handler-v3-11-e0beccb836e2@weissschuh.net/
Reviewed-by: Luis Chamberlain <mcgrof@kernel.org>
Reviewed-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://lore.kernel.org/r/20240508171337.work.861-kees@kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
kernel/seccomp.c

index aca7b437882e98d81d66a5cd2d224b02be0d7fd3..f70e031e06a80faed23b70d71cb53ea45dede8cb 100644 (file)
@@ -2334,7 +2334,7 @@ static bool seccomp_actions_logged_from_names(u32 *actions_logged, char *names)
        return true;
 }
 
-static int read_actions_logged(struct ctl_table *ro_table, void *buffer,
+static int read_actions_logged(const struct ctl_table *ro_table, void *buffer,
                               size_t *lenp, loff_t *ppos)
 {
        char names[sizeof(seccomp_actions_avail)];
@@ -2352,7 +2352,7 @@ static int read_actions_logged(struct ctl_table *ro_table, void *buffer,
        return proc_dostring(&table, 0, buffer, lenp, ppos);
 }
 
-static int write_actions_logged(struct ctl_table *ro_table, void *buffer,
+static int write_actions_logged(const struct ctl_table *ro_table, void *buffer,
                                size_t *lenp, loff_t *ppos, u32 *actions_logged)
 {
        char names[sizeof(seccomp_actions_avail)];