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.
Showing the changes to kernel (28 of 93 files). Show all
Unified · Split
| @@ -5983,7 +5983,7 @@ const struct bpf_prog_ops bpf_syscall_prog_ops = { · 5982 unmodified lines | ||
| 5983 | 5983 | }; |
| 5984 | 5984 | |
| 5985 | 5985 | #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, | |
| 5987 | 5987 | void *buffer, size_t *lenp, loff_t *ppos) |
| 5988 | 5988 | { |
| 5989 | 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 | |
| 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, | |
| 6022 | 6022 | void *buffer, size_t *lenp, loff_t *ppos) |
| 6023 | 6023 | { |
| 6024 | 6024 | int ret, unpriv_enable = *(int *)table->data; |
| @@ -44,7 +44,7 @@ void delayacct_init(void) · 43 unmodified lines | ||
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | #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, | |
| 48 | 48 | size_t *lenp, loff_t *ppos) |
| 49 | 49 | { |
| 50 | 50 | int state = delayacct_on; |
| @@ -270,7 +270,7 @@ exit_put: · 269 unmodified lines | ||
| 270 | 270 | * Used for sysctl_perf_event_max_stack and |
| 271 | 271 | * sysctl_perf_event_max_contexts_per_stack. |
| 272 | 272 | */ |
| 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, | |
| 274 | 274 | void *buffer, size_t *lenp, loff_t *ppos) |
| 275 | 275 | { |
| 276 | 276 | int *value = table->data; |
| @@ -450,7 +450,7 @@ static void update_perf_cpu_limits(void) · 449 unmodified lines | ||
| 450 | 450 | |
| 451 | 451 | static bool perf_rotate_context(struct perf_cpu_pmu_context *cpc); |
| 452 | 452 | |
| 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, | |
| 454 | 454 | void *buffer, size_t *lenp, loff_t *ppos) |
| 455 | 455 | { |
| 456 | 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 | |
| 475 | 475 | int sysctl_perf_cpu_time_max_percent __read_mostly = DEFAULT_CPU_TIME_MAX_PERCENT; |
| 476 | 476 | |
| 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, | |
| 478 | 478 | void *buffer, size_t *lenp, loff_t *ppos) |
| 479 | 479 | { |
| 480 | 480 | int ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos); |
| @@ -3404,7 +3404,7 @@ int unshare_files(void) · 3403 unmodified lines | ||
| 3404 | 3404 | return 0; |
| 3405 | 3405 | } |
| 3406 | 3406 | |
| 3407 | −int sysctl_max_threads(struct ctl_table *table, int write, | |
| 3407 | +int sysctl_max_threads(const struct ctl_table *table, int write, | |
| 3408 | 3408 | void *buffer, size_t *lenp, loff_t *ppos) |
| 3409 | 3409 | { |
| 3410 | 3410 | struct ctl_table t; |
| @@ -239,7 +239,7 @@ static long hung_timeout_jiffies(unsigned long last_checked, · 238 unmodified lines | ||
| 239 | 239 | /* |
| 240 | 240 | * Process updating of timeout sysctl |
| 241 | 241 | */ |
| 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, | |
| 243 | 243 | void *buffer, |
| 244 | 244 | size_t *lenp, loff_t *ppos) |
| 245 | 245 | { |
| @@ -888,7 +888,7 @@ struct kimage *kexec_crash_image; · 887 unmodified lines | ||
| 888 | 888 | static int kexec_load_disabled; |
| 889 | 889 | |
| 890 | 890 | #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, | |
| 892 | 892 | void *buffer, size_t *lenp, loff_t *ppos) |
| 893 | 893 | { |
| 894 | 894 | struct kexec_load_limit *limit = table->data; |
| @@ -939,7 +939,7 @@ static void unoptimize_all_kprobes(void) · 938 unmodified lines | ||
| 939 | 939 | |
| 940 | 940 | static DEFINE_MUTEX(kprobe_sysctl_mutex); |
| 941 | 941 | 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, | |
| 943 | 943 | int write, void *buffer, |
| 944 | 944 | size_t *length, loff_t *ppos) |
| 945 | 945 | { |
| @@ -65,7 +65,7 @@ static struct latency_record latency_record[MAXLR]; · 64 unmodified lines | ||
| 65 | 65 | int latencytop_enabled; |
| 66 | 66 | |
| 67 | 67 | #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, | |
| 69 | 69 | size_t *lenp, loff_t *ppos) |
| 70 | 70 | { |
| 71 | 71 | int err; |
| @@ -261,7 +261,7 @@ void zap_pid_ns_processes(struct pid_namespace *pid_ns) · 260 unmodified lines | ||
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 | #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, | |
| 265 | 265 | void *buffer, size_t *lenp, loff_t *ppos) |
| 266 | 266 | { |
| 267 | 267 | struct pid_namespace *pid_ns = task_active_pid_ns(current); |
| @@ -5,7 +5,7 @@ · 4 unmodified lines | ||
| 5 | 5 | #include <linux/pid_namespace.h> |
| 6 | 6 | |
| 7 | 7 | #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, | |
| 9 | 9 | int write, void *buf, size_t *lenp, loff_t *ppos) |
| 10 | 10 | { |
| 11 | 11 | struct pid_namespace *ns = task_active_pid_ns(current); |
| @@ -8,7 +8,7 @@ · 7 unmodified lines | ||
| 8 | 8 | |
| 9 | 9 | #if defined(CONFIG_PRINTK) && defined(CONFIG_SYSCTL) |
| 10 | 10 | 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, | |
| 12 | 12 | void *buffer, size_t *lenp, loff_t *ppos); |
| 13 | 13 | #else |
| 14 | 14 | #define printk_sysctl_init() do { } while (0) |
| @@ -197,7 +197,7 @@ __setup("printk.devkmsg=", control_devkmsg); · 196 unmodified lines | ||
| 197 | 197 | |
| 198 | 198 | char devkmsg_log_str[DEVKMSG_STR_MAX_SIZE] = "ratelimit"; |
| 199 | 199 | #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, | |
| 201 | 201 | void *buffer, size_t *lenp, loff_t *ppos) |
| 202 | 202 | { |
| 203 | 203 | char old_str[DEVKMSG_STR_MAX_SIZE]; |
| @@ -11,7 +11,7 @@ · 10 unmodified lines | ||
| 11 | 11 | |
| 12 | 12 | static const int ten_thousand = 10000; |
| 13 | 13 | |
| 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, | |
| 15 | 15 | void *buffer, size_t *lenp, loff_t *ppos) |
| 16 | 16 | { |
| 17 | 17 | if (write && !capable(CAP_SYS_ADMIN)) |
| @@ -1806,7 +1806,7 @@ static void uclamp_sync_util_min_rt_default(void) · 1805 unmodified lines | ||
| 1806 | 1806 | uclamp_update_util_min_rt_default(p); |
| 1807 | 1807 | } |
| 1808 | 1808 | |
| 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, | |
| 1810 | 1810 | void *buffer, size_t *lenp, loff_t *ppos) |
| 1811 | 1811 | { |
| 1812 | 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 | |
| 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, | |
| 4396 | 4396 | void *buffer, size_t *lenp, loff_t *ppos) |
| 4397 | 4397 | { |
| 4398 | 4398 | struct ctl_table t; |
| @@ -4461,7 +4461,7 @@ out: · 62 unmodified lines | ||
| 4461 | 4461 | __setup("schedstats=", setup_schedstats); |
| 4462 | 4462 | |
| 4463 | 4463 | #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, | |
| 4465 | 4465 | size_t *lenp, loff_t *ppos) |
| 4466 | 4466 | { |
| 4467 | 4467 | struct ctl_table t; |
| @@ -26,9 +26,9 @@ int sysctl_sched_rt_runtime = 950000; · 25 unmodified lines | ||
| 26 | 26 | |
| 27 | 27 | #ifdef CONFIG_SYSCTL |
| 28 | 28 | 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, | |
| 30 | 30 | 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, | |
| 32 | 32 | size_t *lenp, loff_t *ppos); |
| 33 | 33 | static struct ctl_table sched_rt_sysctls[] = { |
| 34 | 34 | { |
| @@ -2952,7 +2952,7 @@ static void sched_rt_do_global(void) · 2917 unmodified lines | ||
| 2952 | 2952 | raw_spin_unlock_irqrestore(&def_rt_bandwidth.rt_runtime_lock, flags); |
| 2953 | 2953 | } |
| 2954 | 2954 | |
| 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, | |
| 2956 | 2956 | size_t *lenp, loff_t *ppos) |
| 2957 | 2957 | { |
| 2958 | 2958 | int old_period, old_runtime; |
| @@ -2991,7 +2991,7 @@ undo: · 32 unmodified lines | ||
| 2991 | 2991 | return ret; |
| 2992 | 2992 | } |
| 2993 | 2993 | |
| 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, | |
| 2995 | 2995 | size_t *lenp, loff_t *ppos) |
| 2996 | 2996 | { |
| 2997 | 2997 | int ret; |
| @@ -285,7 +285,7 @@ void rebuild_sched_domains_energy(void) · 284 unmodified lines | ||
| 285 | 285 | } |
| 286 | 286 | |
| 287 | 287 | #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, | |
| 289 | 289 | void *buffer, size_t *lenp, loff_t *ppos) |
| 290 | 290 | { |
| 291 | 291 | int ret, state; |
| @@ -2431,7 +2431,7 @@ static void audit_actions_logged(u32 actions_logged, u32 old_actions_logged, · 2430 unmodified lines | ||
| 2431 | 2431 | return audit_seccomp_actions_logged(new, old, !ret); |
| 2432 | 2432 | } |
| 2433 | 2433 | |
| 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, | |
| 2435 | 2435 | void *buffer, size_t *lenp, |
| 2436 | 2436 | loff_t *ppos) |
| 2437 | 2437 | { |
| @@ -21,7 +21,7 @@ · 20 unmodified lines | ||
| 21 | 21 | static DEFINE_STATIC_KEY_FALSE(stack_erasing_bypass); |
| 22 | 22 | |
| 23 | 23 | #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, | |
| 25 | 25 | void __user *buffer, size_t *lenp, loff_t *ppos) |
| 26 | 26 | { |
| 27 | 27 | int ret = 0; |
| @@ -256,7 +256,7 @@ static bool proc_first_pos_non_zero_ignore(loff_t *ppos, · 255 unmodified lines | ||
| 256 | 256 | * |
| 257 | 257 | * Returns 0 on success. |
| 258 | 258 | */ |
| 259 | −int proc_dostring(struct ctl_table *table, int write, | |
| 259 | +int proc_dostring(const struct ctl_table *table, int write, | |
| 260 | 260 | void *buffer, size_t *lenp, loff_t *ppos) |
| 261 | 261 | { |
| 262 | 262 | if (write) |
| @@ -702,7 +702,7 @@ int do_proc_douintvec(const struct ctl_table *table, int write, · 439 unmodified lines | ||
| 702 | 702 | * |
| 703 | 703 | * Returns 0 on success. |
| 704 | 704 | */ |
| 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, | |
| 706 | 706 | size_t *lenp, loff_t *ppos) |
| 707 | 707 | { |
| 708 | 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 | 740 | * Returns 0 on success. |
| 741 | 741 | */ |
| 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, | |
| 743 | 743 | size_t *lenp, loff_t *ppos) |
| 744 | 744 | { |
| 745 | 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 | 759 | * Returns 0 on success. |
| 760 | 760 | */ |
| 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, | |
| 762 | 762 | size_t *lenp, loff_t *ppos) |
| 763 | 763 | { |
| 764 | 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 | 769 | * Taint values can only be increased |
| 770 | 770 | * This means we can safely use a temporary. |
| 771 | 771 | */ |
| 772 | −static int proc_taint(struct ctl_table *table, int write, | |
| 772 | +static int proc_taint(const struct ctl_table *table, int write, | |
| 773 | 773 | void *buffer, size_t *lenp, loff_t *ppos) |
| 774 | 774 | { |
| 775 | 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 | 865 | * Returns 0 on success or -EINVAL on write when the range check fails. |
| 866 | 866 | */ |
| 867 | −int proc_dointvec_minmax(struct ctl_table *table, int write, | |
| 867 | +int proc_dointvec_minmax(const struct ctl_table *table, int write, | |
| 868 | 868 | void *buffer, size_t *lenp, loff_t *ppos) |
| 869 | 869 | { |
| 870 | 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 | 934 | * Returns 0 on success or -ERANGE on write when the range check fails. |
| 935 | 935 | */ |
| 936 | −int proc_douintvec_minmax(struct ctl_table *table, int write, | |
| 936 | +int proc_douintvec_minmax(const struct ctl_table *table, int write, | |
| 937 | 937 | void *buffer, size_t *lenp, loff_t *ppos) |
| 938 | 938 | { |
| 939 | 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 | 962 | * Returns 0 on success or an error on write when the range check fails. |
| 963 | 963 | */ |
| 964 | −int proc_dou8vec_minmax(struct ctl_table *table, int write, | |
| 964 | +int proc_dou8vec_minmax(const struct ctl_table *table, int write, | |
| 965 | 965 | void *buffer, size_t *lenp, loff_t *ppos) |
| 966 | 966 | { |
| 967 | 967 | struct ctl_table tmp; |
| @@ -998,7 +998,7 @@ int proc_dou8vec_minmax(struct ctl_table *table, int write, · 30 unmodified lines | ||
| 998 | 998 | EXPORT_SYMBOL_GPL(proc_dou8vec_minmax); |
| 999 | 999 | |
| 1000 | 1000 | #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, | |
| 1002 | 1002 | void *buffer, size_t *lenp, loff_t *ppos) |
| 1003 | 1003 | { |
| 1004 | 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 | 1116 | * Returns 0 on success. |
| 1117 | 1117 | */ |
| 1118 | −int proc_doulongvec_minmax(struct ctl_table *table, int write, | |
| 1118 | +int proc_doulongvec_minmax(const struct ctl_table *table, int write, | |
| 1119 | 1119 | void *buffer, size_t *lenp, loff_t *ppos) |
| 1120 | 1120 | { |
| 1121 | 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 | 1139 | * Returns 0 on success. |
| 1140 | 1140 | */ |
| 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, | |
| 1142 | 1142 | void *buffer, size_t *lenp, loff_t *ppos) |
| 1143 | 1143 | { |
| 1144 | 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 | 1260 | * Returns 0 on success. |
| 1261 | 1261 | */ |
| 1262 | −int proc_dointvec_jiffies(struct ctl_table *table, int write, | |
| 1262 | +int proc_dointvec_jiffies(const struct ctl_table *table, int write, | |
| 1263 | 1263 | void *buffer, size_t *lenp, loff_t *ppos) |
| 1264 | 1264 | { |
| 1265 | 1265 | return do_proc_dointvec(table,write,buffer,lenp,ppos, |
| 1266 | 1266 | do_proc_dointvec_jiffies_conv,NULL); |
| 1267 | 1267 | } |
| 1268 | 1268 | |
| 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, | |
| 1270 | 1270 | void *buffer, size_t *lenp, loff_t *ppos) |
| 1271 | 1271 | { |
| 1272 | 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 | 1293 | * Returns 0 on success. |
| 1294 | 1294 | */ |
| 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, | |
| 1296 | 1296 | void *buffer, size_t *lenp, loff_t *ppos) |
| 1297 | 1297 | { |
| 1298 | 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 | 1316 | * Returns 0 on success. |
| 1317 | 1317 | */ |
| 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, | |
| 1319 | 1319 | size_t *lenp, loff_t *ppos) |
| 1320 | 1320 | { |
| 1321 | 1321 | return do_proc_dointvec(table, write, buffer, lenp, ppos, |
| 1322 | 1322 | do_proc_dointvec_ms_jiffies_conv, NULL); |
| 1323 | 1323 | } |
| 1324 | 1324 | |
| 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, | |
| 1326 | 1326 | size_t *lenp, loff_t *ppos) |
| 1327 | 1327 | { |
| 1328 | 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 | 1362 | * Returns 0 on success. |
| 1363 | 1363 | */ |
| 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, | |
| 1365 | 1365 | void *buffer, size_t *lenp, loff_t *ppos) |
| 1366 | 1366 | { |
| 1367 | 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 | 1494 | #else /* CONFIG_PROC_SYSCTL */ |
| 1495 | 1495 | |
| 1496 | −int proc_dostring(struct ctl_table *table, int write, | |
| 1496 | +int proc_dostring(const struct ctl_table *table, int write, | |
| 1497 | 1497 | void *buffer, size_t *lenp, loff_t *ppos) |
| 1498 | 1498 | { |
| 1499 | 1499 | return -ENOSYS; |
| 1500 | 1500 | } |
| 1501 | 1501 | |
| 1502 | −int proc_dobool(struct ctl_table *table, int write, | |
| 1502 | +int proc_dobool(const struct ctl_table *table, int write, | |
| 1503 | 1503 | void *buffer, size_t *lenp, loff_t *ppos) |
| 1504 | 1504 | { |
| 1505 | 1505 | return -ENOSYS; |
| 1506 | 1506 | } |
| 1507 | 1507 | |
| 1508 | −int proc_dointvec(struct ctl_table *table, int write, | |
| 1508 | +int proc_dointvec(const struct ctl_table *table, int write, | |
| 1509 | 1509 | void *buffer, size_t *lenp, loff_t *ppos) |
| 1510 | 1510 | { |
| 1511 | 1511 | return -ENOSYS; |
| 1512 | 1512 | } |
| 1513 | 1513 | |
| 1514 | −int proc_douintvec(struct ctl_table *table, int write, | |
| 1514 | +int proc_douintvec(const struct ctl_table *table, int write, | |
| 1515 | 1515 | void *buffer, size_t *lenp, loff_t *ppos) |
| 1516 | 1516 | { |
| 1517 | 1517 | return -ENOSYS; |
| 1518 | 1518 | } |
| 1519 | 1519 | |
| 1520 | −int proc_dointvec_minmax(struct ctl_table *table, int write, | |
| 1520 | +int proc_dointvec_minmax(const struct ctl_table *table, int write, | |
| 1521 | 1521 | void *buffer, size_t *lenp, loff_t *ppos) |
| 1522 | 1522 | { |
| 1523 | 1523 | return -ENOSYS; |
| 1524 | 1524 | } |
| 1525 | 1525 | |
| 1526 | −int proc_douintvec_minmax(struct ctl_table *table, int write, | |
| 1526 | +int proc_douintvec_minmax(const struct ctl_table *table, int write, | |
| 1527 | 1527 | void *buffer, size_t *lenp, loff_t *ppos) |
| 1528 | 1528 | { |
| 1529 | 1529 | return -ENOSYS; |
| 1530 | 1530 | } |
| 1531 | 1531 | |
| 1532 | −int proc_dou8vec_minmax(struct ctl_table *table, int write, | |
| 1532 | +int proc_dou8vec_minmax(const struct ctl_table *table, int write, | |
| 1533 | 1533 | void *buffer, size_t *lenp, loff_t *ppos) |
| 1534 | 1534 | { |
| 1535 | 1535 | return -ENOSYS; |
| 1536 | 1536 | } |
| 1537 | 1537 | |
| 1538 | −int proc_dointvec_jiffies(struct ctl_table *table, int write, | |
| 1538 | +int proc_dointvec_jiffies(const struct ctl_table *table, int write, | |
| 1539 | 1539 | void *buffer, size_t *lenp, loff_t *ppos) |
| 1540 | 1540 | { |
| 1541 | 1541 | return -ENOSYS; |
| 1542 | 1542 | } |
| 1543 | 1543 | |
| 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, | |
| 1545 | 1545 | void *buffer, size_t *lenp, loff_t *ppos) |
| 1546 | 1546 | { |
| 1547 | 1547 | return -ENOSYS; |
| 1548 | 1548 | } |
| 1549 | 1549 | |
| 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, | |
| 1551 | 1551 | void *buffer, size_t *lenp, loff_t *ppos) |
| 1552 | 1552 | { |
| 1553 | 1553 | return -ENOSYS; |
| 1554 | 1554 | } |
| 1555 | 1555 | |
| 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, | |
| 1557 | 1557 | void *buffer, size_t *lenp, loff_t *ppos) |
| 1558 | 1558 | { |
| 1559 | 1559 | return -ENOSYS; |
| 1560 | 1560 | } |
| 1561 | 1561 | |
| 1562 | −int proc_doulongvec_minmax(struct ctl_table *table, int write, | |
| 1562 | +int proc_doulongvec_minmax(const struct ctl_table *table, int write, | |
| 1563 | 1563 | void *buffer, size_t *lenp, loff_t *ppos) |
| 1564 | 1564 | { |
| 1565 | 1565 | return -ENOSYS; |
| 1566 | 1566 | } |
| 1567 | 1567 | |
| 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, | |
| 1569 | 1569 | void *buffer, size_t *lenp, loff_t *ppos) |
| 1570 | 1570 | { |
| 1571 | 1571 | return -ENOSYS; |
| 1572 | 1572 | } |
| 1573 | 1573 | |
| 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, | |
| 1575 | 1575 | void *buffer, size_t *lenp, loff_t *ppos) |
| 1576 | 1576 | { |
| 1577 | 1577 | return -ENOSYS; |
| @@ -1580,7 +1580,7 @@ int proc_do_large_bitmap(struct ctl_table *table, int write, · 2 unmodified lines | ||
| 1580 | 1580 | #endif /* CONFIG_PROC_SYSCTL */ |
| 1581 | 1581 | |
| 1582 | 1582 | #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, | |
| 1584 | 1584 | void *buffer, size_t *lenp, loff_t *ppos) |
| 1585 | 1585 | { |
| 1586 | 1586 | struct static_key *key = (struct static_key *)table->data; |
| @@ -289,7 +289,7 @@ static void timers_update_migration(void) · 288 unmodified lines | ||
| 289 | 289 | } |
| 290 | 290 | |
| 291 | 291 | #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, | |
| 293 | 293 | void *buffer, size_t *lenp, loff_t *ppos) |
| 294 | 294 | { |
| 295 | 295 | int ret; |
| @@ -8735,7 +8735,7 @@ static bool is_permanent_ops_registered(void) · 8734 unmodified lines | ||
| 8735 | 8735 | } |
| 8736 | 8736 | |
| 8737 | 8737 | static int |
| 8738 | −ftrace_enable_sysctl(struct ctl_table *table, int write, | |
| 8738 | +ftrace_enable_sysctl(const struct ctl_table *table, int write, | |
| 8739 | 8739 | void *buffer, size_t *lenp, loff_t *ppos) |
| 8740 | 8740 | { |
| 8741 | 8741 | int ret = -ENODEV; |
| @@ -2767,7 +2767,7 @@ static void output_printk(struct trace_event_buffer *fbuffer) · 2766 unmodified lines | ||
| 2767 | 2767 | raw_spin_unlock_irqrestore(&tracepoint_iter_lock, flags); |
| 2768 | 2768 | } |
| 2769 | 2769 | |
| 2770 | −int tracepoint_printk_sysctl(struct ctl_table *table, int write, | |
| 2770 | +int tracepoint_printk_sysctl(const struct ctl_table *table, int write, | |
| 2771 | 2771 | void *buffer, size_t *lenp, |
| 2772 | 2772 | loff_t *ppos) |
| 2773 | 2773 | { |
| @@ -2885,7 +2885,7 @@ err: · 2884 unmodified lines | ||
| 2885 | 2885 | return -ENODEV; |
| 2886 | 2886 | } |
| 2887 | 2887 | |
| 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, | |
| 2889 | 2889 | void *buffer, size_t *lenp, loff_t *ppos) |
| 2890 | 2890 | { |
| 2891 | 2891 | int ret; |
| @@ -514,7 +514,7 @@ static const struct file_operations stack_trace_filter_fops = { · 513 unmodified lines | ||
| 514 | 514 | #endif /* CONFIG_DYNAMIC_FTRACE */ |
| 515 | 515 | |
| 516 | 516 | 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, | |
| 518 | 518 | size_t *lenp, loff_t *ppos) |
| 519 | 519 | { |
| 520 | 520 | int was_enabled; |
| @@ -495,7 +495,7 @@ int call_usermodehelper(const char *path, char **argv, char **envp, int wait) · 494 unmodified lines | ||
| 495 | 495 | EXPORT_SYMBOL(call_usermodehelper); |
| 496 | 496 | |
| 497 | 497 | #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, | |
| 499 | 499 | void *buffer, size_t *lenp, loff_t *ppos) |
| 500 | 500 | { |
| 501 | 501 | struct ctl_table t; |
| @@ -30,7 +30,7 @@ static void *get_uts(const struct ctl_table *table) · 29 unmodified lines | ||
| 30 | 30 | * Special case of dostring for the UTS structure. This has locks |
| 31 | 31 | * to observe. Should this be in kernel/sys.c ???? |
| 32 | 32 | */ |
| 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, | |
| 34 | 34 | void *buffer, size_t *lenp, loff_t *ppos) |
| 35 | 35 | { |
| 36 | 36 | struct ctl_table uts_table; |
| @@ -983,7 +983,7 @@ static void proc_watchdog_update(void) · 982 unmodified lines | ||
| 983 | 983 | * -------------------|----------------------------------|------------------------------- |
| 984 | 984 | * proc_soft_watchdog | watchdog_softlockup_user_enabled | WATCHDOG_SOFTOCKUP_ENABLED |
| 985 | 985 | */ |
| 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, | |
| 987 | 987 | void *buffer, size_t *lenp, loff_t *ppos) |
| 988 | 988 | { |
| 989 | 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 | 1011 | * /proc/sys/kernel/watchdog |
| 1012 | 1012 | */ |
| 1013 | −static int proc_watchdog(struct ctl_table *table, int write, | |
| 1013 | +static int proc_watchdog(const struct ctl_table *table, int write, | |
| 1014 | 1014 | void *buffer, size_t *lenp, loff_t *ppos) |
| 1015 | 1015 | { |
| 1016 | 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 | 1022 | * /proc/sys/kernel/nmi_watchdog |
| 1023 | 1023 | */ |
| 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, | |
| 1025 | 1025 | void *buffer, size_t *lenp, loff_t *ppos) |
| 1026 | 1026 | { |
| 1027 | 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 | 1035 | * /proc/sys/kernel/soft_watchdog |
| 1036 | 1036 | */ |
| 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, | |
| 1038 | 1038 | void *buffer, size_t *lenp, loff_t *ppos) |
| 1039 | 1039 | { |
| 1040 | 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 | 1046 | * /proc/sys/kernel/watchdog_thresh |
| 1047 | 1047 | */ |
| 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, | |
| 1049 | 1049 | void *buffer, size_t *lenp, loff_t *ppos) |
| 1050 | 1050 | { |
| 1051 | 1051 | int err, old; |
| @@ -1068,7 +1068,7 @@ static int proc_watchdog_thresh(struct ctl_table *table, int write, · 16 unmodified lines | ||
| 1068 | 1068 | * user to specify a mask that will include cpus that have not yet |
| 1069 | 1069 | * been brought online, if desired. |
| 1070 | 1070 | */ |
| 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, | |
| 1072 | 1072 | void *buffer, size_t *lenp, loff_t *ppos) |
| 1073 | 1073 | { |
| 1074 | 1074 | int err; |