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
59835983 };
59845984
59855985 #ifdef CONFIG_SYSCTL
5986−static int bpf_stats_handler(struct ctl_table *table, int write,
5986+static int bpf_stats_handler(const struct ctl_table *table, int write,
59875987 void *buffer, size_t *lenp, loff_t *ppos)
59885988 {
59895989 struct static_key *key = (struct static_key *)table->data;
@@ -6018,7 +6018,7 @@ void __weak unpriv_ebpf_notify(int new_state) · 28 unmodified lines
60186018 {
60196019 }
60206020
6021−static int bpf_unpriv_handler(struct ctl_table *table, int write,
6021+static int bpf_unpriv_handler(const struct ctl_table *table, int write,
60226022 void *buffer, size_t *lenp, loff_t *ppos)
60236023 {
60246024 int ret, unpriv_enable = *(int *)table->data;
kernel/delayacct.c+1−1
@@ -44,7 +44,7 @@ void delayacct_init(void) · 43 unmodified lines
4444 }
4545
4646 #ifdef CONFIG_PROC_SYSCTL
47−static int sysctl_delayacct(struct ctl_table *table, int write, void *buffer,
47+static int sysctl_delayacct(const struct ctl_table *table, int write, void *buffer,
4848 size_t *lenp, loff_t *ppos)
4949 {
5050 int state = delayacct_on;
kernel/events/callchain.c+1−1
@@ -270,7 +270,7 @@ exit_put: · 269 unmodified lines
270270 * Used for sysctl_perf_event_max_stack and
271271 * sysctl_perf_event_max_contexts_per_stack.
272272 */
273−int perf_event_max_stack_handler(struct ctl_table *table, int write,
273+int perf_event_max_stack_handler(const struct ctl_table *table, int write,
274274 void *buffer, size_t *lenp, loff_t *ppos)
275275 {
276276 int *value = table->data;
kernel/events/core.c+2−2
@@ -450,7 +450,7 @@ static void update_perf_cpu_limits(void) · 449 unmodified lines
450450
451451 static bool perf_rotate_context(struct perf_cpu_pmu_context *cpc);
452452
453−int perf_event_max_sample_rate_handler(struct ctl_table *table, int write,
453+int perf_event_max_sample_rate_handler(const struct ctl_table *table, int write,
454454 void *buffer, size_t *lenp, loff_t *ppos)
455455 {
456456 int ret;
@@ -474,7 +474,7 @@ int perf_event_max_sample_rate_handler(struct ctl_table *table, int write, · 17 unmodified lines
474474
475475 int sysctl_perf_cpu_time_max_percent __read_mostly = DEFAULT_CPU_TIME_MAX_PERCENT;
476476
477−int perf_cpu_time_max_percent_handler(struct ctl_table *table, int write,
477+int perf_cpu_time_max_percent_handler(const struct ctl_table *table, int write,
478478 void *buffer, size_t *lenp, loff_t *ppos)
479479 {
480480 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
34043404 return 0;
34053405 }
34063406
3407−int sysctl_max_threads(struct ctl_table *table, int write,
3407+int sysctl_max_threads(const struct ctl_table *table, int write,
34083408 void *buffer, size_t *lenp, loff_t *ppos)
34093409 {
34103410 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
239239 /*
240240 * Process updating of timeout sysctl
241241 */
242−static int proc_dohung_task_timeout_secs(struct ctl_table *table, int write,
242+static int proc_dohung_task_timeout_secs(const struct ctl_table *table, int write,
243243 void *buffer,
244244 size_t *lenp, loff_t *ppos)
245245 {
kernel/kexec_core.c+1−1
@@ -888,7 +888,7 @@ struct kimage *kexec_crash_image; · 887 unmodified lines
888888 static int kexec_load_disabled;
889889
890890 #ifdef CONFIG_SYSCTL
891−static int kexec_limit_handler(struct ctl_table *table, int write,
891+static int kexec_limit_handler(const struct ctl_table *table, int write,
892892 void *buffer, size_t *lenp, loff_t *ppos)
893893 {
894894 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
939939
940940 static DEFINE_MUTEX(kprobe_sysctl_mutex);
941941 static int sysctl_kprobes_optimization;
942−static int proc_kprobes_optimization_handler(struct ctl_table *table,
942+static int proc_kprobes_optimization_handler(const struct ctl_table *table,
943943 int write, void *buffer,
944944 size_t *length, loff_t *ppos)
945945 {
kernel/latencytop.c+1−1
@@ -65,7 +65,7 @@ static struct latency_record latency_record[MAXLR]; · 64 unmodified lines
6565 int latencytop_enabled;
6666
6767 #ifdef CONFIG_SYSCTL
68−static int sysctl_latencytop(struct ctl_table *table, int write, void *buffer,
68+static int sysctl_latencytop(const struct ctl_table *table, int write, void *buffer,
6969 size_t *lenp, loff_t *ppos)
7070 {
7171 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
261261 }
262262
263263 #ifdef CONFIG_CHECKPOINT_RESTORE
264−static int pid_ns_ctl_handler(struct ctl_table *table, int write,
264+static int pid_ns_ctl_handler(const struct ctl_table *table, int write,
265265 void *buffer, size_t *lenp, loff_t *ppos)
266266 {
267267 struct pid_namespace *pid_ns = task_active_pid_ns(current);
kernel/pid_sysctl.h+1−1
@@ -5,7 +5,7 @@ · 4 unmodified lines
55 #include <linux/pid_namespace.h>
66
77 #if defined(CONFIG_SYSCTL) && defined(CONFIG_MEMFD_CREATE)
8−static int pid_mfd_noexec_dointvec_minmax(struct ctl_table *table,
8+static int pid_mfd_noexec_dointvec_minmax(const struct ctl_table *table,
99 int write, void *buf, size_t *lenp, loff_t *ppos)
1010 {
1111 struct pid_namespace *ns = task_active_pid_ns(current);
kernel/printk/internal.h+1−1
@@ -8,7 +8,7 @@ · 7 unmodified lines
88
99 #if defined(CONFIG_PRINTK) && defined(CONFIG_SYSCTL)
1010 void __init printk_sysctl_init(void);
11−int devkmsg_sysctl_set_loglvl(struct ctl_table *table, int write,
11+int devkmsg_sysctl_set_loglvl(const struct ctl_table *table, int write,
1212 void *buffer, size_t *lenp, loff_t *ppos);
1313 #else
1414 #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
197197
198198 char devkmsg_log_str[DEVKMSG_STR_MAX_SIZE] = "ratelimit";
199199 #if defined(CONFIG_PRINTK) && defined(CONFIG_SYSCTL)
200−int devkmsg_sysctl_set_loglvl(struct ctl_table *table, int write,
200+int devkmsg_sysctl_set_loglvl(const struct ctl_table *table, int write,
201201 void *buffer, size_t *lenp, loff_t *ppos)
202202 {
203203 char old_str[DEVKMSG_STR_MAX_SIZE];
kernel/printk/sysctl.c+1−1
@@ -11,7 +11,7 @@ · 10 unmodified lines
1111
1212 static const int ten_thousand = 10000;
1313
14−static int proc_dointvec_minmax_sysadmin(struct ctl_table *table, int write,
14+static int proc_dointvec_minmax_sysadmin(const struct ctl_table *table, int write,
1515 void *buffer, size_t *lenp, loff_t *ppos)
1616 {
1717 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
18061806 uclamp_update_util_min_rt_default(p);
18071807 }
18081808
1809−static int sysctl_sched_uclamp_handler(struct ctl_table *table, int write,
1809+static int sysctl_sched_uclamp_handler(const struct ctl_table *table, int write,
18101810 void *buffer, size_t *lenp, loff_t *ppos)
18111811 {
18121812 bool update_root_tg = false;
@@ -4392,7 +4392,7 @@ static void reset_memory_tiering(void) · 2579 unmodified lines
43924392 }
43934393 }
43944394
4395−static int sysctl_numa_balancing(struct ctl_table *table, int write,
4395+static int sysctl_numa_balancing(const struct ctl_table *table, int write,
43964396 void *buffer, size_t *lenp, loff_t *ppos)
43974397 {
43984398 struct ctl_table t;
@@ -4461,7 +4461,7 @@ out: · 62 unmodified lines
44614461 __setup("schedstats=", setup_schedstats);
44624462
44634463 #ifdef CONFIG_PROC_SYSCTL
4464−static int sysctl_schedstats(struct ctl_table *table, int write, void *buffer,
4464+static int sysctl_schedstats(const struct ctl_table *table, int write, void *buffer,
44654465 size_t *lenp, loff_t *ppos)
44664466 {
44674467 struct ctl_table t;
kernel/sched/rt.c+4−4
@@ -26,9 +26,9 @@ int sysctl_sched_rt_runtime = 950000; · 25 unmodified lines
2626
2727 #ifdef CONFIG_SYSCTL
2828 static int sysctl_sched_rr_timeslice = (MSEC_PER_SEC * RR_TIMESLICE) / HZ;
29−static int sched_rt_handler(struct ctl_table *table, int write, void *buffer,
29+static int sched_rt_handler(const struct ctl_table *table, int write, void *buffer,
3030 size_t *lenp, loff_t *ppos);
31−static int sched_rr_handler(struct ctl_table *table, int write, void *buffer,
31+static int sched_rr_handler(const struct ctl_table *table, int write, void *buffer,
3232 size_t *lenp, loff_t *ppos);
3333 static struct ctl_table sched_rt_sysctls[] = {
3434 {
@@ -2952,7 +2952,7 @@ static void sched_rt_do_global(void) · 2917 unmodified lines
29522952 raw_spin_unlock_irqrestore(&def_rt_bandwidth.rt_runtime_lock, flags);
29532953 }
29542954
2955−static int sched_rt_handler(struct ctl_table *table, int write, void *buffer,
2955+static int sched_rt_handler(const struct ctl_table *table, int write, void *buffer,
29562956 size_t *lenp, loff_t *ppos)
29572957 {
29582958 int old_period, old_runtime;
@@ -2991,7 +2991,7 @@ undo: · 32 unmodified lines
29912991 return ret;
29922992 }
29932993
2994−static int sched_rr_handler(struct ctl_table *table, int write, void *buffer,
2994+static int sched_rr_handler(const struct ctl_table *table, int write, void *buffer,
29952995 size_t *lenp, loff_t *ppos)
29962996 {
29972997 int ret;
kernel/sched/topology.c+1−1
@@ -285,7 +285,7 @@ void rebuild_sched_domains_energy(void) · 284 unmodified lines
285285 }
286286
287287 #ifdef CONFIG_PROC_SYSCTL
288−static int sched_energy_aware_handler(struct ctl_table *table, int write,
288+static int sched_energy_aware_handler(const struct ctl_table *table, int write,
289289 void *buffer, size_t *lenp, loff_t *ppos)
290290 {
291291 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
24312431 return audit_seccomp_actions_logged(new, old, !ret);
24322432 }
24332433
2434−static int seccomp_actions_logged_handler(struct ctl_table *ro_table, int write,
2434+static int seccomp_actions_logged_handler(const struct ctl_table *ro_table, int write,
24352435 void *buffer, size_t *lenp,
24362436 loff_t *ppos)
24372437 {
kernel/stackleak.c+1−1
@@ -21,7 +21,7 @@ · 20 unmodified lines
2121 static DEFINE_STATIC_KEY_FALSE(stack_erasing_bypass);
2222
2323 #ifdef CONFIG_SYSCTL
24−static int stack_erasing_sysctl(struct ctl_table *table, int write,
24+static int stack_erasing_sysctl(const struct ctl_table *table, int write,
2525 void __user *buffer, size_t *lenp, loff_t *ppos)
2626 {
2727 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
256256 *
257257 * Returns 0 on success.
258258 */
259−int proc_dostring(struct ctl_table *table, int write,
259+int proc_dostring(const struct ctl_table *table, int write,
260260 void *buffer, size_t *lenp, loff_t *ppos)
261261 {
262262 if (write)
@@ -702,7 +702,7 @@ int do_proc_douintvec(const struct ctl_table *table, int write, · 439 unmodified lines
702702 *
703703 * Returns 0 on success.
704704 */
705−int proc_dobool(struct ctl_table *table, int write, void *buffer,
705+int proc_dobool(const struct ctl_table *table, int write, void *buffer,
706706 size_t *lenp, loff_t *ppos)
707707 {
708708 struct ctl_table tmp;
@@ -739,7 +739,7 @@ int proc_dobool(struct ctl_table *table, int write, void *buffer, · 30 unmodified lines
739739 *
740740 * Returns 0 on success.
741741 */
742−int proc_dointvec(struct ctl_table *table, int write, void *buffer,
742+int proc_dointvec(const struct ctl_table *table, int write, void *buffer,
743743 size_t *lenp, loff_t *ppos)
744744 {
745745 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
758758 *
759759 * Returns 0 on success.
760760 */
761−int proc_douintvec(struct ctl_table *table, int write, void *buffer,
761+int proc_douintvec(const struct ctl_table *table, int write, void *buffer,
762762 size_t *lenp, loff_t *ppos)
763763 {
764764 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
769769 * Taint values can only be increased
770770 * This means we can safely use a temporary.
771771 */
772−static int proc_taint(struct ctl_table *table, int write,
772+static int proc_taint(const struct ctl_table *table, int write,
773773 void *buffer, size_t *lenp, loff_t *ppos)
774774 {
775775 struct ctl_table t;
@@ -864,7 +864,7 @@ static int do_proc_dointvec_minmax_conv(bool *negp, unsigned long *lvalp, · 88 unmodified lines
864864 *
865865 * Returns 0 on success or -EINVAL on write when the range check fails.
866866 */
867−int proc_dointvec_minmax(struct ctl_table *table, int write,
867+int proc_dointvec_minmax(const struct ctl_table *table, int write,
868868 void *buffer, size_t *lenp, loff_t *ppos)
869869 {
870870 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
933933 *
934934 * Returns 0 on success or -ERANGE on write when the range check fails.
935935 */
936−int proc_douintvec_minmax(struct ctl_table *table, int write,
936+int proc_douintvec_minmax(const struct ctl_table *table, int write,
937937 void *buffer, size_t *lenp, loff_t *ppos)
938938 {
939939 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
961961 *
962962 * Returns 0 on success or an error on write when the range check fails.
963963 */
964−int proc_dou8vec_minmax(struct ctl_table *table, int write,
964+int proc_dou8vec_minmax(const struct ctl_table *table, int write,
965965 void *buffer, size_t *lenp, loff_t *ppos)
966966 {
967967 struct ctl_table tmp;
@@ -998,7 +998,7 @@ int proc_dou8vec_minmax(struct ctl_table *table, int write, · 30 unmodified lines
998998 EXPORT_SYMBOL_GPL(proc_dou8vec_minmax);
999999
10001000 #ifdef CONFIG_MAGIC_SYSRQ
1001−static int sysrq_sysctl_handler(struct ctl_table *table, int write,
1001+static int sysrq_sysctl_handler(const struct ctl_table *table, int write,
10021002 void *buffer, size_t *lenp, loff_t *ppos)
10031003 {
10041004 int tmp, ret;
@@ -1115,7 +1115,7 @@ static int do_proc_doulongvec_minmax(const struct ctl_table *table, int write, · 110 unmodified lines
11151115 *
11161116 * Returns 0 on success.
11171117 */
1118−int proc_doulongvec_minmax(struct ctl_table *table, int write,
1118+int proc_doulongvec_minmax(const struct ctl_table *table, int write,
11191119 void *buffer, size_t *lenp, loff_t *ppos)
11201120 {
11211121 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
11381138 *
11391139 * Returns 0 on success.
11401140 */
1141−int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
1141+int proc_doulongvec_ms_jiffies_minmax(const struct ctl_table *table, int write,
11421142 void *buffer, size_t *lenp, loff_t *ppos)
11431143 {
11441144 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
12591259 *
12601260 * Returns 0 on success.
12611261 */
1262−int proc_dointvec_jiffies(struct ctl_table *table, int write,
1262+int proc_dointvec_jiffies(const struct ctl_table *table, int write,
12631263 void *buffer, size_t *lenp, loff_t *ppos)
12641264 {
12651265 return do_proc_dointvec(table,write,buffer,lenp,ppos,
12661266 do_proc_dointvec_jiffies_conv,NULL);
12671267 }
12681268
1269−int proc_dointvec_ms_jiffies_minmax(struct ctl_table *table, int write,
1269+int proc_dointvec_ms_jiffies_minmax(const struct ctl_table *table, int write,
12701270 void *buffer, size_t *lenp, loff_t *ppos)
12711271 {
12721272 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
12921292 *
12931293 * Returns 0 on success.
12941294 */
1295−int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,
1295+int proc_dointvec_userhz_jiffies(const struct ctl_table *table, int write,
12961296 void *buffer, size_t *lenp, loff_t *ppos)
12971297 {
12981298 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
13151315 *
13161316 * Returns 0 on success.
13171317 */
1318−int proc_dointvec_ms_jiffies(struct ctl_table *table, int write, void *buffer,
1318+int proc_dointvec_ms_jiffies(const struct ctl_table *table, int write, void *buffer,
13191319 size_t *lenp, loff_t *ppos)
13201320 {
13211321 return do_proc_dointvec(table, write, buffer, lenp, ppos,
13221322 do_proc_dointvec_ms_jiffies_conv, NULL);
13231323 }
13241324
1325−static int proc_do_cad_pid(struct ctl_table *table, int write, void *buffer,
1325+static int proc_do_cad_pid(const struct ctl_table *table, int write, void *buffer,
13261326 size_t *lenp, loff_t *ppos)
13271327 {
13281328 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
13611361 *
13621362 * Returns 0 on success.
13631363 */
1364−int proc_do_large_bitmap(struct ctl_table *table, int write,
1364+int proc_do_large_bitmap(const struct ctl_table *table, int write,
13651365 void *buffer, size_t *lenp, loff_t *ppos)
13661366 {
13671367 int err = 0;
@@ -1493,85 +1493,85 @@ int proc_do_large_bitmap(struct ctl_table *table, int write, · 125 unmodified lines
14931493
14941494 #else /* CONFIG_PROC_SYSCTL */
14951495
1496−int proc_dostring(struct ctl_table *table, int write,
1496+int proc_dostring(const struct ctl_table *table, int write,
14971497 void *buffer, size_t *lenp, loff_t *ppos)
14981498 {
14991499 return -ENOSYS;
15001500 }
15011501
1502−int proc_dobool(struct ctl_table *table, int write,
1502+int proc_dobool(const struct ctl_table *table, int write,
15031503 void *buffer, size_t *lenp, loff_t *ppos)
15041504 {
15051505 return -ENOSYS;
15061506 }
15071507
1508−int proc_dointvec(struct ctl_table *table, int write,
1508+int proc_dointvec(const struct ctl_table *table, int write,
15091509 void *buffer, size_t *lenp, loff_t *ppos)
15101510 {
15111511 return -ENOSYS;
15121512 }
15131513
1514−int proc_douintvec(struct ctl_table *table, int write,
1514+int proc_douintvec(const struct ctl_table *table, int write,
15151515 void *buffer, size_t *lenp, loff_t *ppos)
15161516 {
15171517 return -ENOSYS;
15181518 }
15191519
1520−int proc_dointvec_minmax(struct ctl_table *table, int write,
1520+int proc_dointvec_minmax(const struct ctl_table *table, int write,
15211521 void *buffer, size_t *lenp, loff_t *ppos)
15221522 {
15231523 return -ENOSYS;
15241524 }
15251525
1526−int proc_douintvec_minmax(struct ctl_table *table, int write,
1526+int proc_douintvec_minmax(const struct ctl_table *table, int write,
15271527 void *buffer, size_t *lenp, loff_t *ppos)
15281528 {
15291529 return -ENOSYS;
15301530 }
15311531
1532−int proc_dou8vec_minmax(struct ctl_table *table, int write,
1532+int proc_dou8vec_minmax(const struct ctl_table *table, int write,
15331533 void *buffer, size_t *lenp, loff_t *ppos)
15341534 {
15351535 return -ENOSYS;
15361536 }
15371537
1538−int proc_dointvec_jiffies(struct ctl_table *table, int write,
1538+int proc_dointvec_jiffies(const struct ctl_table *table, int write,
15391539 void *buffer, size_t *lenp, loff_t *ppos)
15401540 {
15411541 return -ENOSYS;
15421542 }
15431543
1544−int proc_dointvec_ms_jiffies_minmax(struct ctl_table *table, int write,
1544+int proc_dointvec_ms_jiffies_minmax(const struct ctl_table *table, int write,
15451545 void *buffer, size_t *lenp, loff_t *ppos)
15461546 {
15471547 return -ENOSYS;
15481548 }
15491549
1550−int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,
1550+int proc_dointvec_userhz_jiffies(const struct ctl_table *table, int write,
15511551 void *buffer, size_t *lenp, loff_t *ppos)
15521552 {
15531553 return -ENOSYS;
15541554 }
15551555
1556−int proc_dointvec_ms_jiffies(struct ctl_table *table, int write,
1556+int proc_dointvec_ms_jiffies(const struct ctl_table *table, int write,
15571557 void *buffer, size_t *lenp, loff_t *ppos)
15581558 {
15591559 return -ENOSYS;
15601560 }
15611561
1562−int proc_doulongvec_minmax(struct ctl_table *table, int write,
1562+int proc_doulongvec_minmax(const struct ctl_table *table, int write,
15631563 void *buffer, size_t *lenp, loff_t *ppos)
15641564 {
15651565 return -ENOSYS;
15661566 }
15671567
1568−int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
1568+int proc_doulongvec_ms_jiffies_minmax(const struct ctl_table *table, int write,
15691569 void *buffer, size_t *lenp, loff_t *ppos)
15701570 {
15711571 return -ENOSYS;
15721572 }
15731573
1574−int proc_do_large_bitmap(struct ctl_table *table, int write,
1574+int proc_do_large_bitmap(const struct ctl_table *table, int write,
15751575 void *buffer, size_t *lenp, loff_t *ppos)
15761576 {
15771577 return -ENOSYS;
@@ -1580,7 +1580,7 @@ int proc_do_large_bitmap(struct ctl_table *table, int write, · 2 unmodified lines
15801580 #endif /* CONFIG_PROC_SYSCTL */
15811581
15821582 #if defined(CONFIG_SYSCTL)
1583−int proc_do_static_key(struct ctl_table *table, int write,
1583+int proc_do_static_key(const struct ctl_table *table, int write,
15841584 void *buffer, size_t *lenp, loff_t *ppos)
15851585 {
15861586 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
289289 }
290290
291291 #ifdef CONFIG_SYSCTL
292−static int timer_migration_handler(struct ctl_table *table, int write,
292+static int timer_migration_handler(const struct ctl_table *table, int write,
293293 void *buffer, size_t *lenp, loff_t *ppos)
294294 {
295295 int ret;
kernel/trace/ftrace.c+1−1
@@ -8735,7 +8735,7 @@ static bool is_permanent_ops_registered(void) · 8734 unmodified lines
87358735 }
87368736
87378737 static int
8738−ftrace_enable_sysctl(struct ctl_table *table, int write,
8738+ftrace_enable_sysctl(const struct ctl_table *table, int write,
87398739 void *buffer, size_t *lenp, loff_t *ppos)
87408740 {
87418741 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
27672767 raw_spin_unlock_irqrestore(&tracepoint_iter_lock, flags);
27682768 }
27692769
2770−int tracepoint_printk_sysctl(struct ctl_table *table, int write,
2770+int tracepoint_printk_sysctl(const struct ctl_table *table, int write,
27712771 void *buffer, size_t *lenp,
27722772 loff_t *ppos)
27732773 {
kernel/trace/trace_events_user.c+1−1
@@ -2885,7 +2885,7 @@ err: · 2884 unmodified lines
28852885 return -ENODEV;
28862886 }
28872887
2888−static int set_max_user_events_sysctl(struct ctl_table *table, int write,
2888+static int set_max_user_events_sysctl(const struct ctl_table *table, int write,
28892889 void *buffer, size_t *lenp, loff_t *ppos)
28902890 {
28912891 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
514514 #endif /* CONFIG_DYNAMIC_FTRACE */
515515
516516 int
517−stack_trace_sysctl(struct ctl_table *table, int write, void *buffer,
517+stack_trace_sysctl(const struct ctl_table *table, int write, void *buffer,
518518 size_t *lenp, loff_t *ppos)
519519 {
520520 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
495495 EXPORT_SYMBOL(call_usermodehelper);
496496
497497 #if defined(CONFIG_SYSCTL)
498−static int proc_cap_handler(struct ctl_table *table, int write,
498+static int proc_cap_handler(const struct ctl_table *table, int write,
499499 void *buffer, size_t *lenp, loff_t *ppos)
500500 {
501501 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
3030 * Special case of dostring for the UTS structure. This has locks
3131 * to observe. Should this be in kernel/sys.c ????
3232 */
33−static int proc_do_uts_string(struct ctl_table *table, int write,
33+static int proc_do_uts_string(const struct ctl_table *table, int write,
3434 void *buffer, size_t *lenp, loff_t *ppos)
3535 {
3636 struct ctl_table uts_table;
kernel/watchdog.c+6−6
@@ -983,7 +983,7 @@ static void proc_watchdog_update(void) · 982 unmodified lines
983983 * -------------------|----------------------------------|-------------------------------
984984 * proc_soft_watchdog | watchdog_softlockup_user_enabled | WATCHDOG_SOFTOCKUP_ENABLED
985985 */
986−static int proc_watchdog_common(int which, struct ctl_table *table, int write,
986+static int proc_watchdog_common(int which, const struct ctl_table *table, int write,
987987 void *buffer, size_t *lenp, loff_t *ppos)
988988 {
989989 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
10101010 /*
10111011 * /proc/sys/kernel/watchdog
10121012 */
1013−static int proc_watchdog(struct ctl_table *table, int write,
1013+static int proc_watchdog(const struct ctl_table *table, int write,
10141014 void *buffer, size_t *lenp, loff_t *ppos)
10151015 {
10161016 return proc_watchdog_common(WATCHDOG_HARDLOCKUP_ENABLED |
@@ -1021,7 +1021,7 @@ static int proc_watchdog(struct ctl_table *table, int write, · 4 unmodified lines
10211021 /*
10221022 * /proc/sys/kernel/nmi_watchdog
10231023 */
1024−static int proc_nmi_watchdog(struct ctl_table *table, int write,
1024+static int proc_nmi_watchdog(const struct ctl_table *table, int write,
10251025 void *buffer, size_t *lenp, loff_t *ppos)
10261026 {
10271027 if (!watchdog_hardlockup_available && write)
@@ -1034,7 +1034,7 @@ static int proc_nmi_watchdog(struct ctl_table *table, int write, · 6 unmodified lines
10341034 /*
10351035 * /proc/sys/kernel/soft_watchdog
10361036 */
1037−static int proc_soft_watchdog(struct ctl_table *table, int write,
1037+static int proc_soft_watchdog(const struct ctl_table *table, int write,
10381038 void *buffer, size_t *lenp, loff_t *ppos)
10391039 {
10401040 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
10451045 /*
10461046 * /proc/sys/kernel/watchdog_thresh
10471047 */
1048−static int proc_watchdog_thresh(struct ctl_table *table, int write,
1048+static int proc_watchdog_thresh(const struct ctl_table *table, int write,
10491049 void *buffer, size_t *lenp, loff_t *ppos)
10501050 {
10511051 int err, old;
@@ -1068,7 +1068,7 @@ static int proc_watchdog_thresh(struct ctl_table *table, int write, · 16 unmodified lines
10681068 * user to specify a mask that will include cpus that have not yet
10691069 * been brought online, if desired.
10701070 */
1071−static int proc_watchdog_cpumask(struct ctl_table *table, int write,
1071+static int proc_watchdog_cpumask(const struct ctl_table *table, int write,
10721072 void *buffer, size_t *lenp, loff_t *ppos)
10731073 {
10741074 int err;