History

sysctl: treewide: constify the ctl_table argument of proc_handlers

const qualify the struct ctl_table argument in the proc_handler function signatures. This is a prerequisite to moving the static ctl_table structs into .rodata data which will ensure that proc_handler function pointers cannot be modified. This patch has been generated by the following coccinelle script: ``` virtual patch @r1@ identifier ctl, write, buffer, lenp, ppos; identifier func !~ "appldata_(timer|interval)_handler|sched_(rt|rr)_handler|rds_tcp_skbuf_handler|proc_sctp_do_(hmac_alg|rto_min|rto_max|udp_port|alpha_beta|auth|probe_interval)"; @@ int func( - struct ctl_table *ctl + const struct ctl_table *ctl ,int write, void *buffer, size_t *lenp, loff_t *ppos); @r2@ identifier func, ctl, write, buffer, lenp, ppos; @@ int func( - struct ctl_table *ctl + const struct ctl_table *ctl ,int write, void *buffer, size_t *lenp, loff_t *ppos) { ... } @r3@ identifier func; @@ int func( - struct ctl_table * + const struct ctl_table * ,int , void *, size_t *, loff_t *); @r4@ identifier func, ctl; @@ int func( - struct ctl_table *ctl + const struct ctl_table *ctl ,int , void *, size_t *, loff_t *); @r5@ identifier func, write, buffer, lenp, ppos; @@ int func( - struct ctl_table * + const struct ctl_table * ,int write, void *buffer, size_t *lenp, loff_t *ppos); ``` * Code formatting was adjusted in xfs_sysctl.c to comply with code conventions. The xfs_stats_clear_proc_handler, xfs_panic_mask_proc_handler and xfs_deprecated_dointvec_minmax where adjusted. * The ctl_table argument in proc_watchdog_common was const qualified. This is called from a proc_handler itself and is calling back into another proc_handler, making it necessary to change it as part of the proc_handler migration.

Joel Granados committed 2 years ago

Commit 78eb4ea1 parent 7a3fad393 files · +258 −258Browse files

Showing the changes to kernel (28 of 93 files). Show all

Unified · Split

28 files
  1. kernel/bpf/syscall.c +2 −2
  2. kernel/delayacct.c +1 −1
  3. kernel/events/callchain.c +1 −1
  4. kernel/events/core.c +2 −2
  5. kernel/fork.c +1 −1
  6. kernel/hung_task.c +1 −1
  7. kernel/kexec_core.c +1 −1
  8. kernel/kprobes.c +1 −1
  9. kernel/latencytop.c +1 −1
  10. kernel/pid_namespace.c +1 −1
  11. kernel/pid_sysctl.h +1 −1
  12. kernel/printk/internal.h +1 −1
  13. kernel/printk/printk.c +1 −1
  14. kernel/printk/sysctl.c +1 −1
  15. kernel/sched/core.c +3 −3
  16. kernel/sched/rt.c +4 −4
  17. kernel/sched/topology.c +1 −1
  18. kernel/seccomp.c +1 −1
  19. kernel/stackleak.c +1 −1
  20. kernel/sysctl.c +32 −32
  21. kernel/time/timer.c +1 −1
  22. kernel/trace/ftrace.c +1 −1
  23. kernel/trace/trace.c +1 −1
  24. kernel/trace/trace_events_user.c +1 −1
  25. kernel/trace/trace_stack.c +1 −1
  26. kernel/umh.c +1 −1
  27. kernel/utsname_sysctl.c +1 −1
  28. kernel/watchdog.c +6 −6
kernel/bpf/syscall.c+2−2
@@ -5983,7 +5983,7 @@ const struct bpf_prog_ops bpf_syscall_prog_ops = { · 5982 unmodified lines
5983};5983};
5984 5984
5985#ifdef CONFIG_SYSCTL5985#ifdef CONFIG_SYSCTL
5986static int bpf_stats_handler(struct ctl_table *table, int write,5986static int bpf_stats_handler(const struct ctl_table *table, int write,
5987 void *buffer, size_t *lenp, loff_t *ppos)5987 void *buffer, size_t *lenp, loff_t *ppos)
5988{5988{
5989 struct static_key *key = (struct static_key *)table->data;5989 struct static_key *key = (struct static_key *)table->data;
@@ -6018,7 +6018,7 @@ void __weak unpriv_ebpf_notify(int new_state) · 28 unmodified lines
6018{6018{
6019}6019}
6020 6020
6021static int bpf_unpriv_handler(struct ctl_table *table, int write,6021static int bpf_unpriv_handler(const struct ctl_table *table, int write,
6022 void *buffer, size_t *lenp, loff_t *ppos)6022 void *buffer, size_t *lenp, loff_t *ppos)
6023{6023{
6024 int ret, unpriv_enable = *(int *)table->data;6024 int ret, unpriv_enable = *(int *)table->data;
kernel/delayacct.c+1−1
@@ -44,7 +44,7 @@ void delayacct_init(void) · 43 unmodified lines
44}44}
45 45
46#ifdef CONFIG_PROC_SYSCTL46#ifdef CONFIG_PROC_SYSCTL
47static int sysctl_delayacct(struct ctl_table *table, int write, void *buffer,47static int sysctl_delayacct(const struct ctl_table *table, int write, void *buffer,
48 size_t *lenp, loff_t *ppos)48 size_t *lenp, loff_t *ppos)
49{49{
50 int state = delayacct_on;50 int state = delayacct_on;
kernel/events/callchain.c+1−1
@@ -270,7 +270,7 @@ exit_put: · 269 unmodified lines
270 * Used for sysctl_perf_event_max_stack and270 * Used for sysctl_perf_event_max_stack and
271 * sysctl_perf_event_max_contexts_per_stack.271 * sysctl_perf_event_max_contexts_per_stack.
272 */272 */
273int perf_event_max_stack_handler(struct ctl_table *table, int write,273int perf_event_max_stack_handler(const struct ctl_table *table, int write,
274 void *buffer, size_t *lenp, loff_t *ppos)274 void *buffer, size_t *lenp, loff_t *ppos)
275{275{
276 int *value = table->data;276 int *value = table->data;
kernel/events/core.c+2−2
@@ -450,7 +450,7 @@ static void update_perf_cpu_limits(void) · 449 unmodified lines
450 450
451static bool perf_rotate_context(struct perf_cpu_pmu_context *cpc);451static bool perf_rotate_context(struct perf_cpu_pmu_context *cpc);
452 452
453int perf_event_max_sample_rate_handler(struct ctl_table *table, int write,453int perf_event_max_sample_rate_handler(const struct ctl_table *table, int write,
454 void *buffer, size_t *lenp, loff_t *ppos)454 void *buffer, size_t *lenp, loff_t *ppos)
455{455{
456 int ret;456 int ret;
@@ -474,7 +474,7 @@ int perf_event_max_sample_rate_handler(struct ctl_table *table, int write, · 17 unmodified lines
474 474
475int sysctl_perf_cpu_time_max_percent __read_mostly = DEFAULT_CPU_TIME_MAX_PERCENT;475int sysctl_perf_cpu_time_max_percent __read_mostly = DEFAULT_CPU_TIME_MAX_PERCENT;
476 476
477int perf_cpu_time_max_percent_handler(struct ctl_table *table, int write,477int perf_cpu_time_max_percent_handler(const struct ctl_table *table, int write,
478 void *buffer, size_t *lenp, loff_t *ppos)478 void *buffer, size_t *lenp, loff_t *ppos)
479{479{
480 int ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos);480 int ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos);
kernel/fork.c+1−1
@@ -3404,7 +3404,7 @@ int unshare_files(void) · 3403 unmodified lines
3404 return 0;3404 return 0;
3405}3405}
3406 3406
3407int sysctl_max_threads(struct ctl_table *table, int write,3407int sysctl_max_threads(const struct ctl_table *table, int write,
3408 void *buffer, size_t *lenp, loff_t *ppos)3408 void *buffer, size_t *lenp, loff_t *ppos)
3409{3409{
3410 struct ctl_table t;3410 struct ctl_table t;
kernel/hung_task.c+1−1
@@ -239,7 +239,7 @@ static long hung_timeout_jiffies(unsigned long last_checked, · 238 unmodified lines
239/*239/*
240 * Process updating of timeout sysctl240 * Process updating of timeout sysctl
241 */241 */
242static int proc_dohung_task_timeout_secs(struct ctl_table *table, int write,242static int proc_dohung_task_timeout_secs(const struct ctl_table *table, int write,
243 void *buffer,243 void *buffer,
244 size_t *lenp, loff_t *ppos)244 size_t *lenp, loff_t *ppos)
245{245{
kernel/kexec_core.c+1−1
@@ -888,7 +888,7 @@ struct kimage *kexec_crash_image; · 887 unmodified lines
888static int kexec_load_disabled;888static int kexec_load_disabled;
889 889
890#ifdef CONFIG_SYSCTL890#ifdef CONFIG_SYSCTL
891static int kexec_limit_handler(struct ctl_table *table, int write,891static int kexec_limit_handler(const struct ctl_table *table, int write,
892 void *buffer, size_t *lenp, loff_t *ppos)892 void *buffer, size_t *lenp, loff_t *ppos)
893{893{
894 struct kexec_load_limit *limit = table->data;894 struct kexec_load_limit *limit = table->data;
kernel/kprobes.c+1−1
@@ -939,7 +939,7 @@ static void unoptimize_all_kprobes(void) · 938 unmodified lines
939 939
940static DEFINE_MUTEX(kprobe_sysctl_mutex);940static DEFINE_MUTEX(kprobe_sysctl_mutex);
941static int sysctl_kprobes_optimization;941static int sysctl_kprobes_optimization;
942static int proc_kprobes_optimization_handler(struct ctl_table *table,942static int proc_kprobes_optimization_handler(const struct ctl_table *table,
943 int write, void *buffer,943 int write, void *buffer,
944 size_t *length, loff_t *ppos)944 size_t *length, loff_t *ppos)
945{945{
kernel/latencytop.c+1−1
@@ -65,7 +65,7 @@ static struct latency_record latency_record[MAXLR]; · 64 unmodified lines
65int latencytop_enabled;65int latencytop_enabled;
66 66
67#ifdef CONFIG_SYSCTL67#ifdef CONFIG_SYSCTL
68static int sysctl_latencytop(struct ctl_table *table, int write, void *buffer,68static int sysctl_latencytop(const struct ctl_table *table, int write, void *buffer,
69 size_t *lenp, loff_t *ppos)69 size_t *lenp, loff_t *ppos)
70{70{
71 int err;71 int err;
kernel/pid_namespace.c+1−1
@@ -261,7 +261,7 @@ void zap_pid_ns_processes(struct pid_namespace *pid_ns) · 260 unmodified lines
261}261}
262 262
263#ifdef CONFIG_CHECKPOINT_RESTORE263#ifdef CONFIG_CHECKPOINT_RESTORE
264static int pid_ns_ctl_handler(struct ctl_table *table, int write,264static int pid_ns_ctl_handler(const struct ctl_table *table, int write,
265 void *buffer, size_t *lenp, loff_t *ppos)265 void *buffer, size_t *lenp, loff_t *ppos)
266{266{
267 struct pid_namespace *pid_ns = task_active_pid_ns(current);267 struct pid_namespace *pid_ns = task_active_pid_ns(current);
kernel/pid_sysctl.h+1−1
@@ -5,7 +5,7 @@ · 4 unmodified lines
5#include <linux/pid_namespace.h>5#include <linux/pid_namespace.h>
6 6
7#if defined(CONFIG_SYSCTL) && defined(CONFIG_MEMFD_CREATE)7#if defined(CONFIG_SYSCTL) && defined(CONFIG_MEMFD_CREATE)
8static int pid_mfd_noexec_dointvec_minmax(struct ctl_table *table,8static int pid_mfd_noexec_dointvec_minmax(const struct ctl_table *table,
9 int write, void *buf, size_t *lenp, loff_t *ppos)9 int write, void *buf, size_t *lenp, loff_t *ppos)
10{10{
11 struct pid_namespace *ns = task_active_pid_ns(current);11 struct pid_namespace *ns = task_active_pid_ns(current);
kernel/printk/internal.h+1−1
@@ -8,7 +8,7 @@ · 7 unmodified lines
8 8
9#if defined(CONFIG_PRINTK) && defined(CONFIG_SYSCTL)9#if defined(CONFIG_PRINTK) && defined(CONFIG_SYSCTL)
10void __init printk_sysctl_init(void);10void __init printk_sysctl_init(void);
11int devkmsg_sysctl_set_loglvl(struct ctl_table *table, int write,11int devkmsg_sysctl_set_loglvl(const struct ctl_table *table, int write,
12 void *buffer, size_t *lenp, loff_t *ppos);12 void *buffer, size_t *lenp, loff_t *ppos);
13#else13#else
14#define printk_sysctl_init() do { } while (0)14#define printk_sysctl_init() do { } while (0)
kernel/printk/printk.c+1−1
@@ -197,7 +197,7 @@ __setup("printk.devkmsg=", control_devkmsg); · 196 unmodified lines
197 197
198char devkmsg_log_str[DEVKMSG_STR_MAX_SIZE] = "ratelimit";198char devkmsg_log_str[DEVKMSG_STR_MAX_SIZE] = "ratelimit";
199#if defined(CONFIG_PRINTK) && defined(CONFIG_SYSCTL)199#if defined(CONFIG_PRINTK) && defined(CONFIG_SYSCTL)
200int devkmsg_sysctl_set_loglvl(struct ctl_table *table, int write,200int devkmsg_sysctl_set_loglvl(const struct ctl_table *table, int write,
201 void *buffer, size_t *lenp, loff_t *ppos)201 void *buffer, size_t *lenp, loff_t *ppos)
202{202{
203 char old_str[DEVKMSG_STR_MAX_SIZE];203 char old_str[DEVKMSG_STR_MAX_SIZE];
kernel/printk/sysctl.c+1−1
@@ -11,7 +11,7 @@ · 10 unmodified lines
11 11
12static const int ten_thousand = 10000;12static const int ten_thousand = 10000;
13 13
14static int proc_dointvec_minmax_sysadmin(struct ctl_table *table, int write,14static int proc_dointvec_minmax_sysadmin(const struct ctl_table *table, int write,
15 void *buffer, size_t *lenp, loff_t *ppos)15 void *buffer, size_t *lenp, loff_t *ppos)
16{16{
17 if (write && !capable(CAP_SYS_ADMIN))17 if (write && !capable(CAP_SYS_ADMIN))
kernel/sched/core.c+3−3
@@ -1806,7 +1806,7 @@ static void uclamp_sync_util_min_rt_default(void) · 1805 unmodified lines
1806 uclamp_update_util_min_rt_default(p);1806 uclamp_update_util_min_rt_default(p);
1807}1807}
1808 1808
1809static int sysctl_sched_uclamp_handler(struct ctl_table *table, int write,1809static int sysctl_sched_uclamp_handler(const struct ctl_table *table, int write,
1810 void *buffer, size_t *lenp, loff_t *ppos)1810 void *buffer, size_t *lenp, loff_t *ppos)
1811{1811{
1812 bool update_root_tg = false;1812 bool update_root_tg = false;
@@ -4392,7 +4392,7 @@ static void reset_memory_tiering(void) · 2579 unmodified lines
4392 }4392 }
4393}4393}
4394 4394
4395static int sysctl_numa_balancing(struct ctl_table *table, int write,4395static int sysctl_numa_balancing(const struct ctl_table *table, int write,
4396 void *buffer, size_t *lenp, loff_t *ppos)4396 void *buffer, size_t *lenp, loff_t *ppos)
4397{4397{
4398 struct ctl_table t;4398 struct ctl_table t;
@@ -4461,7 +4461,7 @@ out: · 62 unmodified lines
4461__setup("schedstats=", setup_schedstats);4461__setup("schedstats=", setup_schedstats);
4462 4462
4463#ifdef CONFIG_PROC_SYSCTL4463#ifdef CONFIG_PROC_SYSCTL
4464static int sysctl_schedstats(struct ctl_table *table, int write, void *buffer,4464static int sysctl_schedstats(const struct ctl_table *table, int write, void *buffer,
4465 size_t *lenp, loff_t *ppos)4465 size_t *lenp, loff_t *ppos)
4466{4466{
4467 struct ctl_table t;4467 struct ctl_table t;
kernel/sched/rt.c+4−4
@@ -26,9 +26,9 @@ int sysctl_sched_rt_runtime = 950000; · 25 unmodified lines
26 26
27#ifdef CONFIG_SYSCTL27#ifdef CONFIG_SYSCTL
28static int sysctl_sched_rr_timeslice = (MSEC_PER_SEC * RR_TIMESLICE) / HZ;28static int sysctl_sched_rr_timeslice = (MSEC_PER_SEC * RR_TIMESLICE) / HZ;
29static int sched_rt_handler(struct ctl_table *table, int write, void *buffer,29static int sched_rt_handler(const struct ctl_table *table, int write, void *buffer,
30 size_t *lenp, loff_t *ppos);30 size_t *lenp, loff_t *ppos);
31static int sched_rr_handler(struct ctl_table *table, int write, void *buffer,31static int sched_rr_handler(const struct ctl_table *table, int write, void *buffer,
32 size_t *lenp, loff_t *ppos);32 size_t *lenp, loff_t *ppos);
33static struct ctl_table sched_rt_sysctls[] = {33static struct ctl_table sched_rt_sysctls[] = {
34 {34 {
@@ -2952,7 +2952,7 @@ static void sched_rt_do_global(void) · 2917 unmodified lines
2952 raw_spin_unlock_irqrestore(&def_rt_bandwidth.rt_runtime_lock, flags);2952 raw_spin_unlock_irqrestore(&def_rt_bandwidth.rt_runtime_lock, flags);
2953}2953}
2954 2954
2955static int sched_rt_handler(struct ctl_table *table, int write, void *buffer,2955static int sched_rt_handler(const struct ctl_table *table, int write, void *buffer,
2956 size_t *lenp, loff_t *ppos)2956 size_t *lenp, loff_t *ppos)
2957{2957{
2958 int old_period, old_runtime;2958 int old_period, old_runtime;
@@ -2991,7 +2991,7 @@ undo: · 32 unmodified lines
2991 return ret;2991 return ret;
2992}2992}
2993 2993
2994static int sched_rr_handler(struct ctl_table *table, int write, void *buffer,2994static int sched_rr_handler(const struct ctl_table *table, int write, void *buffer,
2995 size_t *lenp, loff_t *ppos)2995 size_t *lenp, loff_t *ppos)
2996{2996{
2997 int ret;2997 int ret;
kernel/sched/topology.c+1−1
@@ -285,7 +285,7 @@ void rebuild_sched_domains_energy(void) · 284 unmodified lines
285}285}
286 286
287#ifdef CONFIG_PROC_SYSCTL287#ifdef CONFIG_PROC_SYSCTL
288static int sched_energy_aware_handler(struct ctl_table *table, int write,288static int sched_energy_aware_handler(const struct ctl_table *table, int write,
289 void *buffer, size_t *lenp, loff_t *ppos)289 void *buffer, size_t *lenp, loff_t *ppos)
290{290{
291 int ret, state;291 int ret, state;
kernel/seccomp.c+1−1
@@ -2431,7 +2431,7 @@ static void audit_actions_logged(u32 actions_logged, u32 old_actions_logged, · 2430 unmodified lines
2431 return audit_seccomp_actions_logged(new, old, !ret);2431 return audit_seccomp_actions_logged(new, old, !ret);
2432}2432}
2433 2433
2434static int seccomp_actions_logged_handler(struct ctl_table *ro_table, int write,2434static int seccomp_actions_logged_handler(const struct ctl_table *ro_table, int write,
2435 void *buffer, size_t *lenp,2435 void *buffer, size_t *lenp,
2436 loff_t *ppos)2436 loff_t *ppos)
2437{2437{
kernel/stackleak.c+1−1
@@ -21,7 +21,7 @@ · 20 unmodified lines
21static DEFINE_STATIC_KEY_FALSE(stack_erasing_bypass);21static DEFINE_STATIC_KEY_FALSE(stack_erasing_bypass);
22 22
23#ifdef CONFIG_SYSCTL23#ifdef CONFIG_SYSCTL
24static int stack_erasing_sysctl(struct ctl_table *table, int write,24static int stack_erasing_sysctl(const struct ctl_table *table, int write,
25 void __user *buffer, size_t *lenp, loff_t *ppos)25 void __user *buffer, size_t *lenp, loff_t *ppos)
26{26{
27 int ret = 0;27 int ret = 0;
kernel/sysctl.c+32−32
@@ -256,7 +256,7 @@ static bool proc_first_pos_non_zero_ignore(loff_t *ppos, · 255 unmodified lines
256 *256 *
257 * Returns 0 on success.257 * Returns 0 on success.
258 */258 */
259int proc_dostring(struct ctl_table *table, int write,259int proc_dostring(const struct ctl_table *table, int write,
260 void *buffer, size_t *lenp, loff_t *ppos)260 void *buffer, size_t *lenp, loff_t *ppos)
261{261{
262 if (write)262 if (write)
@@ -702,7 +702,7 @@ int do_proc_douintvec(const struct ctl_table *table, int write, · 439 unmodified lines
702 *702 *
703 * Returns 0 on success.703 * Returns 0 on success.
704 */704 */
705int proc_dobool(struct ctl_table *table, int write, void *buffer,705int proc_dobool(const struct ctl_table *table, int write, void *buffer,
706 size_t *lenp, loff_t *ppos)706 size_t *lenp, loff_t *ppos)
707{707{
708 struct ctl_table tmp;708 struct ctl_table tmp;
@@ -739,7 +739,7 @@ int proc_dobool(struct ctl_table *table, int write, void *buffer, · 30 unmodified lines
739 *739 *
740 * Returns 0 on success.740 * Returns 0 on success.
741 */741 */
742int proc_dointvec(struct ctl_table *table, int write, void *buffer,742int proc_dointvec(const struct ctl_table *table, int write, void *buffer,
743 size_t *lenp, loff_t *ppos)743 size_t *lenp, loff_t *ppos)
744{744{
745 return do_proc_dointvec(table, write, buffer, lenp, ppos, NULL, NULL);745 return do_proc_dointvec(table, write, buffer, lenp, ppos, NULL, NULL);
@@ -758,7 +758,7 @@ int proc_dointvec(struct ctl_table *table, int write, void *buffer, · 12 unmodified lines
758 *758 *
759 * Returns 0 on success.759 * Returns 0 on success.
760 */760 */
761int proc_douintvec(struct ctl_table *table, int write, void *buffer,761int proc_douintvec(const struct ctl_table *table, int write, void *buffer,
762 size_t *lenp, loff_t *ppos)762 size_t *lenp, loff_t *ppos)
763{763{
764 return do_proc_douintvec(table, write, buffer, lenp, ppos,764 return do_proc_douintvec(table, write, buffer, lenp, ppos,
@@ -769,7 +769,7 @@ int proc_douintvec(struct ctl_table *table, int write, void *buffer, · 4 unmodified lines
769 * Taint values can only be increased769 * Taint values can only be increased
770 * This means we can safely use a temporary.770 * This means we can safely use a temporary.
771 */771 */
772static int proc_taint(struct ctl_table *table, int write,772static int proc_taint(const struct ctl_table *table, int write,
773 void *buffer, size_t *lenp, loff_t *ppos)773 void *buffer, size_t *lenp, loff_t *ppos)
774{774{
775 struct ctl_table t;775 struct ctl_table t;
@@ -864,7 +864,7 @@ static int do_proc_dointvec_minmax_conv(bool *negp, unsigned long *lvalp, · 88 unmodified lines
864 *864 *
865 * Returns 0 on success or -EINVAL on write when the range check fails.865 * Returns 0 on success or -EINVAL on write when the range check fails.
866 */866 */
867int proc_dointvec_minmax(struct ctl_table *table, int write,867int proc_dointvec_minmax(const struct ctl_table *table, int write,
868 void *buffer, size_t *lenp, loff_t *ppos)868 void *buffer, size_t *lenp, loff_t *ppos)
869{869{
870 struct do_proc_dointvec_minmax_conv_param param = {870 struct do_proc_dointvec_minmax_conv_param param = {
@@ -933,7 +933,7 @@ static int do_proc_douintvec_minmax_conv(unsigned long *lvalp, · 62 unmodified lines
933 *933 *
934 * Returns 0 on success or -ERANGE on write when the range check fails.934 * Returns 0 on success or -ERANGE on write when the range check fails.
935 */935 */
936int proc_douintvec_minmax(struct ctl_table *table, int write,936int proc_douintvec_minmax(const struct ctl_table *table, int write,
937 void *buffer, size_t *lenp, loff_t *ppos)937 void *buffer, size_t *lenp, loff_t *ppos)
938{938{
939 struct do_proc_douintvec_minmax_conv_param param = {939 struct do_proc_douintvec_minmax_conv_param param = {
@@ -961,7 +961,7 @@ int proc_douintvec_minmax(struct ctl_table *table, int write, · 21 unmodified lines
961 *961 *
962 * Returns 0 on success or an error on write when the range check fails.962 * Returns 0 on success or an error on write when the range check fails.
963 */963 */
964int proc_dou8vec_minmax(struct ctl_table *table, int write,964int proc_dou8vec_minmax(const struct ctl_table *table, int write,
965 void *buffer, size_t *lenp, loff_t *ppos)965 void *buffer, size_t *lenp, loff_t *ppos)
966{966{
967 struct ctl_table tmp;967 struct ctl_table tmp;
@@ -998,7 +998,7 @@ int proc_dou8vec_minmax(struct ctl_table *table, int write, · 30 unmodified lines
998EXPORT_SYMBOL_GPL(proc_dou8vec_minmax);998EXPORT_SYMBOL_GPL(proc_dou8vec_minmax);
999 999
1000#ifdef CONFIG_MAGIC_SYSRQ1000#ifdef CONFIG_MAGIC_SYSRQ
1001static int sysrq_sysctl_handler(struct ctl_table *table, int write,1001static int sysrq_sysctl_handler(const struct ctl_table *table, int write,
1002 void *buffer, size_t *lenp, loff_t *ppos)1002 void *buffer, size_t *lenp, loff_t *ppos)
1003{1003{
1004 int tmp, ret;1004 int tmp, ret;
@@ -1115,7 +1115,7 @@ static int do_proc_doulongvec_minmax(const struct ctl_table *table, int write, · 110 unmodified lines
1115 *1115 *
1116 * Returns 0 on success.1116 * Returns 0 on success.
1117 */1117 */
1118int proc_doulongvec_minmax(struct ctl_table *table, int write,1118int proc_doulongvec_minmax(const struct ctl_table *table, int write,
1119 void *buffer, size_t *lenp, loff_t *ppos)1119 void *buffer, size_t *lenp, loff_t *ppos)
1120{1120{
1121 return do_proc_doulongvec_minmax(table, write, buffer, lenp, ppos, 1l, 1l);1121 return do_proc_doulongvec_minmax(table, write, buffer, lenp, ppos, 1l, 1l);
@@ -1138,7 +1138,7 @@ int proc_doulongvec_minmax(struct ctl_table *table, int write, · 16 unmodified lines
1138 *1138 *
1139 * Returns 0 on success.1139 * Returns 0 on success.
1140 */1140 */
1141int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,1141int proc_doulongvec_ms_jiffies_minmax(const struct ctl_table *table, int write,
1142 void *buffer, size_t *lenp, loff_t *ppos)1142 void *buffer, size_t *lenp, loff_t *ppos)
1143{1143{
1144 return do_proc_doulongvec_minmax(table, write, buffer,1144 return do_proc_doulongvec_minmax(table, write, buffer,
@@ -1259,14 +1259,14 @@ static int do_proc_dointvec_ms_jiffies_minmax_conv(bool *negp, unsigned long *lv · 114 unmodified lines
1259 *1259 *
1260 * Returns 0 on success.1260 * Returns 0 on success.
1261 */1261 */
1262int proc_dointvec_jiffies(struct ctl_table *table, int write,1262int proc_dointvec_jiffies(const struct ctl_table *table, int write,
1263 void *buffer, size_t *lenp, loff_t *ppos)1263 void *buffer, size_t *lenp, loff_t *ppos)
1264{1264{
1265 return do_proc_dointvec(table,write,buffer,lenp,ppos,1265 return do_proc_dointvec(table,write,buffer,lenp,ppos,
1266 do_proc_dointvec_jiffies_conv,NULL);1266 do_proc_dointvec_jiffies_conv,NULL);
1267}1267}
1268 1268
1269int proc_dointvec_ms_jiffies_minmax(struct ctl_table *table, int write,1269int proc_dointvec_ms_jiffies_minmax(const struct ctl_table *table, int write,
1270 void *buffer, size_t *lenp, loff_t *ppos)1270 void *buffer, size_t *lenp, loff_t *ppos)
1271{1271{
1272 struct do_proc_dointvec_minmax_conv_param param = {1272 struct do_proc_dointvec_minmax_conv_param param = {
@@ -1292,7 +1292,7 @@ int proc_dointvec_ms_jiffies_minmax(struct ctl_table *table, int write, · 19 unmodified lines
1292 *1292 *
1293 * Returns 0 on success.1293 * Returns 0 on success.
1294 */1294 */
1295int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,1295int proc_dointvec_userhz_jiffies(const struct ctl_table *table, int write,
1296 void *buffer, size_t *lenp, loff_t *ppos)1296 void *buffer, size_t *lenp, loff_t *ppos)
1297{1297{
1298 return do_proc_dointvec(table, write, buffer, lenp, ppos,1298 return do_proc_dointvec(table, write, buffer, lenp, ppos,
@@ -1315,14 +1315,14 @@ int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write, · 16 unmodified lines
1315 *1315 *
1316 * Returns 0 on success.1316 * Returns 0 on success.
1317 */1317 */
1318int proc_dointvec_ms_jiffies(struct ctl_table *table, int write, void *buffer,1318int proc_dointvec_ms_jiffies(const struct ctl_table *table, int write, void *buffer,
1319 size_t *lenp, loff_t *ppos)1319 size_t *lenp, loff_t *ppos)
1320{1320{
1321 return do_proc_dointvec(table, write, buffer, lenp, ppos,1321 return do_proc_dointvec(table, write, buffer, lenp, ppos,
1322 do_proc_dointvec_ms_jiffies_conv, NULL);1322 do_proc_dointvec_ms_jiffies_conv, NULL);
1323}1323}
1324 1324
1325static int proc_do_cad_pid(struct ctl_table *table, int write, void *buffer,1325static int proc_do_cad_pid(const struct ctl_table *table, int write, void *buffer,
1326 size_t *lenp, loff_t *ppos)1326 size_t *lenp, loff_t *ppos)
1327{1327{
1328 struct pid *new_pid;1328 struct pid *new_pid;
@@ -1361,7 +1361,7 @@ static int proc_do_cad_pid(struct ctl_table *table, int write, void *buffer, · 32 unmodified lines
1361 *1361 *
1362 * Returns 0 on success.1362 * Returns 0 on success.
1363 */1363 */
1364int proc_do_large_bitmap(struct ctl_table *table, int write,1364int proc_do_large_bitmap(const struct ctl_table *table, int write,
1365 void *buffer, size_t *lenp, loff_t *ppos)1365 void *buffer, size_t *lenp, loff_t *ppos)
1366{1366{
1367 int err = 0;1367 int err = 0;
@@ -1493,85 +1493,85 @@ int proc_do_large_bitmap(struct ctl_table *table, int write, · 125 unmodified lines
1493 1493
1494#else /* CONFIG_PROC_SYSCTL */1494#else /* CONFIG_PROC_SYSCTL */
1495 1495
1496int proc_dostring(struct ctl_table *table, int write,1496int proc_dostring(const struct ctl_table *table, int write,
1497 void *buffer, size_t *lenp, loff_t *ppos)1497 void *buffer, size_t *lenp, loff_t *ppos)
1498{1498{
1499 return -ENOSYS;1499 return -ENOSYS;
1500}1500}
1501 1501
1502int proc_dobool(struct ctl_table *table, int write,1502int proc_dobool(const struct ctl_table *table, int write,
1503 void *buffer, size_t *lenp, loff_t *ppos)1503 void *buffer, size_t *lenp, loff_t *ppos)
1504{1504{
1505 return -ENOSYS;1505 return -ENOSYS;
1506}1506}
1507 1507
1508int proc_dointvec(struct ctl_table *table, int write,1508int proc_dointvec(const struct ctl_table *table, int write,
1509 void *buffer, size_t *lenp, loff_t *ppos)1509 void *buffer, size_t *lenp, loff_t *ppos)
1510{1510{
1511 return -ENOSYS;1511 return -ENOSYS;
1512}1512}
1513 1513
1514int proc_douintvec(struct ctl_table *table, int write,1514int proc_douintvec(const struct ctl_table *table, int write,
1515 void *buffer, size_t *lenp, loff_t *ppos)1515 void *buffer, size_t *lenp, loff_t *ppos)
1516{1516{
1517 return -ENOSYS;1517 return -ENOSYS;
1518}1518}
1519 1519
1520int proc_dointvec_minmax(struct ctl_table *table, int write,1520int proc_dointvec_minmax(const struct ctl_table *table, int write,
1521 void *buffer, size_t *lenp, loff_t *ppos)1521 void *buffer, size_t *lenp, loff_t *ppos)
1522{1522{
1523 return -ENOSYS;1523 return -ENOSYS;
1524}1524}
1525 1525
1526int proc_douintvec_minmax(struct ctl_table *table, int write,1526int proc_douintvec_minmax(const struct ctl_table *table, int write,
1527 void *buffer, size_t *lenp, loff_t *ppos)1527 void *buffer, size_t *lenp, loff_t *ppos)
1528{1528{
1529 return -ENOSYS;1529 return -ENOSYS;
1530}1530}
1531 1531
1532int proc_dou8vec_minmax(struct ctl_table *table, int write,1532int proc_dou8vec_minmax(const struct ctl_table *table, int write,
1533 void *buffer, size_t *lenp, loff_t *ppos)1533 void *buffer, size_t *lenp, loff_t *ppos)
1534{1534{
1535 return -ENOSYS;1535 return -ENOSYS;
1536}1536}
1537 1537
1538int proc_dointvec_jiffies(struct ctl_table *table, int write,1538int proc_dointvec_jiffies(const struct ctl_table *table, int write,
1539 void *buffer, size_t *lenp, loff_t *ppos)1539 void *buffer, size_t *lenp, loff_t *ppos)
1540{1540{
1541 return -ENOSYS;1541 return -ENOSYS;
1542}1542}
1543 1543
1544int proc_dointvec_ms_jiffies_minmax(struct ctl_table *table, int write,1544int proc_dointvec_ms_jiffies_minmax(const struct ctl_table *table, int write,
1545 void *buffer, size_t *lenp, loff_t *ppos)1545 void *buffer, size_t *lenp, loff_t *ppos)
1546{1546{
1547 return -ENOSYS;1547 return -ENOSYS;
1548}1548}
1549 1549
1550int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,1550int proc_dointvec_userhz_jiffies(const struct ctl_table *table, int write,
1551 void *buffer, size_t *lenp, loff_t *ppos)1551 void *buffer, size_t *lenp, loff_t *ppos)
1552{1552{
1553 return -ENOSYS;1553 return -ENOSYS;
1554}1554}
1555 1555
1556int proc_dointvec_ms_jiffies(struct ctl_table *table, int write,1556int proc_dointvec_ms_jiffies(const struct ctl_table *table, int write,
1557 void *buffer, size_t *lenp, loff_t *ppos)1557 void *buffer, size_t *lenp, loff_t *ppos)
1558{1558{
1559 return -ENOSYS;1559 return -ENOSYS;
1560}1560}
1561 1561
1562int proc_doulongvec_minmax(struct ctl_table *table, int write,1562int proc_doulongvec_minmax(const struct ctl_table *table, int write,
1563 void *buffer, size_t *lenp, loff_t *ppos)1563 void *buffer, size_t *lenp, loff_t *ppos)
1564{1564{
1565 return -ENOSYS;1565 return -ENOSYS;
1566}1566}
1567 1567
1568int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,1568int proc_doulongvec_ms_jiffies_minmax(const struct ctl_table *table, int write,
1569 void *buffer, size_t *lenp, loff_t *ppos)1569 void *buffer, size_t *lenp, loff_t *ppos)
1570{1570{
1571 return -ENOSYS;1571 return -ENOSYS;
1572}1572}
1573 1573
1574int proc_do_large_bitmap(struct ctl_table *table, int write,1574int proc_do_large_bitmap(const struct ctl_table *table, int write,
1575 void *buffer, size_t *lenp, loff_t *ppos)1575 void *buffer, size_t *lenp, loff_t *ppos)
1576{1576{
1577 return -ENOSYS;1577 return -ENOSYS;
@@ -1580,7 +1580,7 @@ int proc_do_large_bitmap(struct ctl_table *table, int write, · 2 unmodified lines
1580#endif /* CONFIG_PROC_SYSCTL */1580#endif /* CONFIG_PROC_SYSCTL */
1581 1581
1582#if defined(CONFIG_SYSCTL)1582#if defined(CONFIG_SYSCTL)
1583int proc_do_static_key(struct ctl_table *table, int write,1583int proc_do_static_key(const struct ctl_table *table, int write,
1584 void *buffer, size_t *lenp, loff_t *ppos)1584 void *buffer, size_t *lenp, loff_t *ppos)
1585{1585{
1586 struct static_key *key = (struct static_key *)table->data;1586 struct static_key *key = (struct static_key *)table->data;
kernel/time/timer.c+1−1
@@ -289,7 +289,7 @@ static void timers_update_migration(void) · 288 unmodified lines
289}289}
290 290
291#ifdef CONFIG_SYSCTL291#ifdef CONFIG_SYSCTL
292static int timer_migration_handler(struct ctl_table *table, int write,292static int timer_migration_handler(const struct ctl_table *table, int write,
293 void *buffer, size_t *lenp, loff_t *ppos)293 void *buffer, size_t *lenp, loff_t *ppos)
294{294{
295 int ret;295 int ret;
kernel/trace/ftrace.c+1−1
@@ -8735,7 +8735,7 @@ static bool is_permanent_ops_registered(void) · 8734 unmodified lines
8735}8735}
8736 8736
8737static int8737static int
8738ftrace_enable_sysctl(struct ctl_table *table, int write,8738ftrace_enable_sysctl(const struct ctl_table *table, int write,
8739 void *buffer, size_t *lenp, loff_t *ppos)8739 void *buffer, size_t *lenp, loff_t *ppos)
8740{8740{
8741 int ret = -ENODEV;8741 int ret = -ENODEV;
kernel/trace/trace.c+1−1
@@ -2767,7 +2767,7 @@ static void output_printk(struct trace_event_buffer *fbuffer) · 2766 unmodified lines
2767 raw_spin_unlock_irqrestore(&tracepoint_iter_lock, flags);2767 raw_spin_unlock_irqrestore(&tracepoint_iter_lock, flags);
2768}2768}
2769 2769
2770int tracepoint_printk_sysctl(struct ctl_table *table, int write,2770int tracepoint_printk_sysctl(const struct ctl_table *table, int write,
2771 void *buffer, size_t *lenp,2771 void *buffer, size_t *lenp,
2772 loff_t *ppos)2772 loff_t *ppos)
2773{2773{
kernel/trace/trace_events_user.c+1−1
@@ -2885,7 +2885,7 @@ err: · 2884 unmodified lines
2885 return -ENODEV;2885 return -ENODEV;
2886}2886}
2887 2887
2888static int set_max_user_events_sysctl(struct ctl_table *table, int write,2888static int set_max_user_events_sysctl(const struct ctl_table *table, int write,
2889 void *buffer, size_t *lenp, loff_t *ppos)2889 void *buffer, size_t *lenp, loff_t *ppos)
2890{2890{
2891 int ret;2891 int ret;
kernel/trace/trace_stack.c+1−1
@@ -514,7 +514,7 @@ static const struct file_operations stack_trace_filter_fops = { · 513 unmodified lines
514#endif /* CONFIG_DYNAMIC_FTRACE */514#endif /* CONFIG_DYNAMIC_FTRACE */
515 515
516int516int
517stack_trace_sysctl(struct ctl_table *table, int write, void *buffer,517stack_trace_sysctl(const struct ctl_table *table, int write, void *buffer,
518 size_t *lenp, loff_t *ppos)518 size_t *lenp, loff_t *ppos)
519{519{
520 int was_enabled;520 int was_enabled;
kernel/umh.c+1−1
@@ -495,7 +495,7 @@ int call_usermodehelper(const char *path, char **argv, char **envp, int wait) · 494 unmodified lines
495EXPORT_SYMBOL(call_usermodehelper);495EXPORT_SYMBOL(call_usermodehelper);
496 496
497#if defined(CONFIG_SYSCTL)497#if defined(CONFIG_SYSCTL)
498static int proc_cap_handler(struct ctl_table *table, int write,498static int proc_cap_handler(const struct ctl_table *table, int write,
499 void *buffer, size_t *lenp, loff_t *ppos)499 void *buffer, size_t *lenp, loff_t *ppos)
500{500{
501 struct ctl_table t;501 struct ctl_table t;
kernel/utsname_sysctl.c+1−1
@@ -30,7 +30,7 @@ static void *get_uts(const struct ctl_table *table) · 29 unmodified lines
30 * Special case of dostring for the UTS structure. This has locks30 * Special case of dostring for the UTS structure. This has locks
31 * to observe. Should this be in kernel/sys.c ????31 * to observe. Should this be in kernel/sys.c ????
32 */32 */
33static int proc_do_uts_string(struct ctl_table *table, int write,33static int proc_do_uts_string(const struct ctl_table *table, int write,
34 void *buffer, size_t *lenp, loff_t *ppos)34 void *buffer, size_t *lenp, loff_t *ppos)
35{35{
36 struct ctl_table uts_table;36 struct ctl_table uts_table;
kernel/watchdog.c+6−6
@@ -983,7 +983,7 @@ static void proc_watchdog_update(void) · 982 unmodified lines
983 * -------------------|----------------------------------|-------------------------------983 * -------------------|----------------------------------|-------------------------------
984 * proc_soft_watchdog | watchdog_softlockup_user_enabled | WATCHDOG_SOFTOCKUP_ENABLED984 * proc_soft_watchdog | watchdog_softlockup_user_enabled | WATCHDOG_SOFTOCKUP_ENABLED
985 */985 */
986static int proc_watchdog_common(int which, struct ctl_table *table, int write,986static int proc_watchdog_common(int which, const struct ctl_table *table, int write,
987 void *buffer, size_t *lenp, loff_t *ppos)987 void *buffer, size_t *lenp, loff_t *ppos)
988{988{
989 int err, old, *param = table->data;989 int err, old, *param = table->data;
@@ -1010,7 +1010,7 @@ static int proc_watchdog_common(int which, struct ctl_table *table, int write, · 20 unmodified lines
1010/*1010/*
1011 * /proc/sys/kernel/watchdog1011 * /proc/sys/kernel/watchdog
1012 */1012 */
1013static int proc_watchdog(struct ctl_table *table, int write,1013static int proc_watchdog(const struct ctl_table *table, int write,
1014 void *buffer, size_t *lenp, loff_t *ppos)1014 void *buffer, size_t *lenp, loff_t *ppos)
1015{1015{
1016 return proc_watchdog_common(WATCHDOG_HARDLOCKUP_ENABLED |1016 return proc_watchdog_common(WATCHDOG_HARDLOCKUP_ENABLED |
@@ -1021,7 +1021,7 @@ static int proc_watchdog(struct ctl_table *table, int write, · 4 unmodified lines
1021/*1021/*
1022 * /proc/sys/kernel/nmi_watchdog1022 * /proc/sys/kernel/nmi_watchdog
1023 */1023 */
1024static int proc_nmi_watchdog(struct ctl_table *table, int write,1024static int proc_nmi_watchdog(const struct ctl_table *table, int write,
1025 void *buffer, size_t *lenp, loff_t *ppos)1025 void *buffer, size_t *lenp, loff_t *ppos)
1026{1026{
1027 if (!watchdog_hardlockup_available && write)1027 if (!watchdog_hardlockup_available && write)
@@ -1034,7 +1034,7 @@ static int proc_nmi_watchdog(struct ctl_table *table, int write, · 6 unmodified lines
1034/*1034/*
1035 * /proc/sys/kernel/soft_watchdog1035 * /proc/sys/kernel/soft_watchdog
1036 */1036 */
1037static int proc_soft_watchdog(struct ctl_table *table, int write,1037static int proc_soft_watchdog(const struct ctl_table *table, int write,
1038 void *buffer, size_t *lenp, loff_t *ppos)1038 void *buffer, size_t *lenp, loff_t *ppos)
1039{1039{
1040 return proc_watchdog_common(WATCHDOG_SOFTOCKUP_ENABLED,1040 return proc_watchdog_common(WATCHDOG_SOFTOCKUP_ENABLED,
@@ -1045,7 +1045,7 @@ static int proc_soft_watchdog(struct ctl_table *table, int write, · 4 unmodified lines
1045/*1045/*
1046 * /proc/sys/kernel/watchdog_thresh1046 * /proc/sys/kernel/watchdog_thresh
1047 */1047 */
1048static int proc_watchdog_thresh(struct ctl_table *table, int write,1048static int proc_watchdog_thresh(const struct ctl_table *table, int write,
1049 void *buffer, size_t *lenp, loff_t *ppos)1049 void *buffer, size_t *lenp, loff_t *ppos)
1050{1050{
1051 int err, old;1051 int err, old;
@@ -1068,7 +1068,7 @@ static int proc_watchdog_thresh(struct ctl_table *table, int write, · 16 unmodified lines
1068 * user to specify a mask that will include cpus that have not yet1068 * user to specify a mask that will include cpus that have not yet
1069 * been brought online, if desired.1069 * been brought online, if desired.
1070 */1070 */
1071static int proc_watchdog_cpumask(struct ctl_table *table, int write,1071static int proc_watchdog_cpumask(const struct ctl_table *table, int write,
1072 void *buffer, size_t *lenp, loff_t *ppos)1072 void *buffer, size_t *lenp, loff_t *ppos)
1073{1073{
1074 int err;1074 int err;