treewide: const qualify ctl_tables where applicable
authorJoel Granados <joel.granados@kernel.org>
Tue, 28 Jan 2025 12:48:37 +0000 (13:48 +0100)
committerJoel Granados <joel.granados@kernel.org>
Tue, 28 Jan 2025 12:48:37 +0000 (13:48 +0100)
Add the const qualifier to all the ctl_tables in the tree except for
watchdog_hardlockup_sysctl, memory_allocation_profiling_sysctls,
loadpin_sysctl_table and the ones calling register_net_sysctl (./net,
drivers/inifiniband dirs). These are special cases as they use a
registration function with a non-const qualified ctl_table argument or
modify the arrays before passing them on to the registration function.

Constifying ctl_table structs will prevent the modification of
proc_handler function pointers as the arrays would reside in .rodata.
This is made possible after commit 78eb4ea25cd5 ("sysctl: treewide:
constify the ctl_table argument of proc_handlers") constified all the
proc_handlers.

Created this by running an spatch followed by a sed command:
Spatch:
    virtual patch

    @
    depends on !(file in "net")
    disable optional_qualifier
    @

    identifier table_name != {
      watchdog_hardlockup_sysctl,
      iwcm_ctl_table,
      ucma_ctl_table,
      memory_allocation_profiling_sysctls,
      loadpin_sysctl_table
    };
    @@

    + const
    struct ctl_table table_name [] = { ... };

sed:
    sed --in-place \
      -e "s/struct ctl_table .table = &uts_kern/const struct ctl_table *table = \&uts_kern/" \
      kernel/utsname_sysctl.c

Reviewed-by: Song Liu <song@kernel.org>
Acked-by: Steven Rostedt (Google) <rostedt@goodmis.org> # for kernel/trace/
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com> # SCSI
Reviewed-by: Darrick J. Wong <djwong@kernel.org> # xfs
Acked-by: Jani Nikula <jani.nikula@intel.com>
Acked-by: Corey Minyard <cminyard@mvista.com>
Acked-by: Wei Liu <wei.liu@kernel.org>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Bill O'Donnell <bodonnel@redhat.com>
Acked-by: Baoquan He <bhe@redhat.com>
Acked-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
Acked-by: Anna Schumaker <anna.schumaker@oracle.com>
Signed-off-by: Joel Granados <joel.granados@kernel.org>
106 files changed:
arch/arm/kernel/isa.c
arch/arm64/kernel/fpsimd.c
arch/arm64/kernel/process.c
arch/powerpc/kernel/idle.c
arch/powerpc/platforms/pseries/mobility.c
arch/riscv/kernel/process.c
arch/riscv/kernel/vector.c
arch/s390/appldata/appldata_base.c
arch/s390/kernel/debug.c
arch/s390/kernel/hiperdispatch.c
arch/s390/kernel/topology.c
arch/s390/mm/cmm.c
arch/s390/mm/pgalloc.c
arch/x86/entry/vdso/vdso32-setup.c
arch/x86/kernel/cpu/bus_lock.c
crypto/fips.c
drivers/base/firmware_loader/fallback_table.c
drivers/cdrom/cdrom.c
drivers/char/hpet.c
drivers/char/ipmi/ipmi_poweroff.c
drivers/char/random.c
drivers/gpu/drm/i915/i915_perf.c
drivers/gpu/drm/xe/xe_observation.c
drivers/hv/hv_common.c
drivers/md/md.c
drivers/misc/sgi-xp/xpc_main.c
drivers/perf/arm_pmuv3.c
drivers/perf/riscv_pmu_sbi.c
drivers/scsi/scsi_sysctl.c
drivers/scsi/sg.c
drivers/tty/tty_io.c
drivers/xen/balloon.c
fs/aio.c
fs/cachefiles/error_inject.c
fs/coda/sysctl.c
fs/coredump.c
fs/dcache.c
fs/devpts/inode.c
fs/eventpoll.c
fs/exec.c
fs/file_table.c
fs/fuse/sysctl.c
fs/inode.c
fs/lockd/svc.c
fs/locks.c
fs/namei.c
fs/namespace.c
fs/nfs/nfs4sysctl.c
fs/nfs/sysctl.c
fs/notify/dnotify/dnotify.c
fs/notify/fanotify/fanotify_user.c
fs/notify/inotify/inotify_user.c
fs/ocfs2/stackglue.c
fs/pipe.c
fs/quota/dquot.c
fs/sysctls.c
fs/userfaultfd.c
fs/verity/init.c
fs/xfs/xfs_sysctl.c
init/do_mounts_initrd.c
io_uring/io_uring.c
ipc/ipc_sysctl.c
ipc/mq_sysctl.c
kernel/acct.c
kernel/bpf/syscall.c
kernel/delayacct.c
kernel/exit.c
kernel/hung_task.c
kernel/kexec_core.c
kernel/kprobes.c
kernel/latencytop.c
kernel/locking/lockdep.c
kernel/panic.c
kernel/pid.c
kernel/pid_namespace.c
kernel/pid_sysctl.h
kernel/printk/sysctl.c
kernel/reboot.c
kernel/sched/autogroup.c
kernel/sched/core.c
kernel/sched/deadline.c
kernel/sched/fair.c
kernel/sched/rt.c
kernel/sched/topology.c
kernel/seccomp.c
kernel/signal.c
kernel/stackleak.c
kernel/sysctl-test.c
kernel/sysctl.c
kernel/time/timer.c
kernel/trace/ftrace.c
kernel/trace/trace_events_user.c
kernel/umh.c
kernel/utsname_sysctl.c
kernel/watchdog.c
lib/test_sysctl.c
mm/compaction.c
mm/hugetlb.c
mm/hugetlb_vmemmap.c
mm/memory-failure.c
mm/oom_kill.c
mm/page-writeback.c
mm/page_alloc.c
security/apparmor/lsm.c
security/keys/sysctl.c
security/yama/yama_lsm.c

index 905b1b1..db8be60 100644 (file)
@@ -16,7 +16,7 @@
 
 static unsigned int isa_membase, isa_portbase, isa_portshift;
 
-static struct ctl_table ctl_isa_vars[] = {
+static const struct ctl_table ctl_isa_vars[] = {
        {
                .procname       = "membase",
                .data           = &isa_membase, 
index 8c4c1a2..2b601d8 100644 (file)
@@ -562,7 +562,7 @@ static int vec_proc_do_default_vl(const struct ctl_table *table, int write,
        return 0;
 }
 
-static struct ctl_table sve_default_vl_table[] = {
+static const struct ctl_table sve_default_vl_table[] = {
        {
                .procname       = "sve_default_vector_length",
                .mode           = 0644,
@@ -585,7 +585,7 @@ static int __init sve_sysctl_init(void) { return 0; }
 #endif /* ! (CONFIG_ARM64_SVE && CONFIG_SYSCTL) */
 
 #if defined(CONFIG_ARM64_SME) && defined(CONFIG_SYSCTL)
-static struct ctl_table sme_default_vl_table[] = {
+static const struct ctl_table sme_default_vl_table[] = {
        {
                .procname       = "sme_default_vector_length",
                .mode           = 0644,
index 2968a33..42faebb 100644 (file)
@@ -859,7 +859,7 @@ long get_tagged_addr_ctrl(struct task_struct *task)
  * disable it for tasks that already opted in to the relaxed ABI.
  */
 
-static struct ctl_table tagged_addr_sysctl_table[] = {
+static const struct ctl_table tagged_addr_sysctl_table[] = {
        {
                .procname       = "tagged_addr_disabled",
                .mode           = 0644,
index 30b56c6..e527cd3 100644 (file)
@@ -97,7 +97,7 @@ void power4_idle(void)
 /*
  * Register the sysctl to set/clear powersave_nap.
  */
-static struct ctl_table powersave_nap_ctl_table[] = {
+static const struct ctl_table powersave_nap_ctl_table[] = {
        {
                .procname       = "powersave-nap",
                .data           = &powersave_nap,
index 1798f0f..62bd8e2 100644 (file)
@@ -53,7 +53,7 @@ struct update_props_workarea {
 static unsigned int nmi_wd_lpm_factor = 200;
 
 #ifdef CONFIG_SYSCTL
-static struct ctl_table nmi_wd_lpm_factor_ctl_table[] = {
+static const struct ctl_table nmi_wd_lpm_factor_ctl_table[] = {
        {
                .procname       = "nmi_wd_lpm_factor",
                .data           = &nmi_wd_lpm_factor,
index 58b6482..7891294 100644 (file)
@@ -364,7 +364,7 @@ static bool try_to_set_pmm(unsigned long value)
  * disable it for tasks that already opted in to the relaxed ABI.
  */
 
-static struct ctl_table tagged_addr_sysctl_table[] = {
+static const struct ctl_table tagged_addr_sysctl_table[] = {
        {
                .procname       = "tagged_addr_disabled",
                .mode           = 0644,
index 8218188..d022b02 100644 (file)
@@ -287,7 +287,7 @@ long riscv_v_vstate_ctrl_set_current(unsigned long arg)
 
 #ifdef CONFIG_SYSCTL
 
-static struct ctl_table riscv_v_default_vstate_table[] = {
+static const struct ctl_table riscv_v_default_vstate_table[] = {
        {
                .procname       = "riscv_v_default_allow",
                .data           = &riscv_v_implicit_uacc,
index 91a30e0..dd7ba75 100644 (file)
@@ -52,7 +52,7 @@ static int appldata_interval_handler(const struct ctl_table *ctl, int write,
                                     void *buffer, size_t *lenp, loff_t *ppos);
 
 static struct ctl_table_header *appldata_sysctl_header;
-static struct ctl_table appldata_table[] = {
+static const struct ctl_table appldata_table[] = {
        {
                .procname       = "timer",
                .mode           = S_IRUGO | S_IWUSR,
index ba6b732..ce038e9 100644 (file)
@@ -1122,7 +1122,7 @@ static int s390dbf_procactive(const struct ctl_table *table, int write,
                return 0;
 }
 
-static struct ctl_table s390dbf_table[] = {
+static const struct ctl_table s390dbf_table[] = {
        {
                .procname       = "debug_stoppable",
                .data           = &debug_stoppable,
index 2a99a21..7857a7e 100644 (file)
@@ -292,7 +292,7 @@ static int hiperdispatch_ctl_handler(const struct ctl_table *ctl, int write,
        return 0;
 }
 
-static struct ctl_table hiperdispatch_ctl_table[] = {
+static const struct ctl_table hiperdispatch_ctl_table[] = {
        {
                .procname       = "hiperdispatch",
                .mode           = 0644,
index 3808f94..211cc83 100644 (file)
@@ -667,7 +667,7 @@ static int polarization_ctl_handler(const struct ctl_table *ctl, int write,
        return set_polarization(polarization);
 }
 
-static struct ctl_table topology_ctl_table[] = {
+static const struct ctl_table topology_ctl_table[] = {
        {
                .procname       = "topology",
                .mode           = 0644,
index 7bf0f69..39f44b6 100644 (file)
@@ -332,7 +332,7 @@ static int cmm_timeout_handler(const struct ctl_table *ctl, int write,
        return 0;
 }
 
-static struct ctl_table cmm_table[] = {
+static const struct ctl_table cmm_table[] = {
        {
                .procname       = "cmm_pages",
                .mode           = 0644,
index d33f55b..cd2fef7 100644 (file)
@@ -21,7 +21,7 @@
 int page_table_allocate_pgste = 0;
 EXPORT_SYMBOL(page_table_allocate_pgste);
 
-static struct ctl_table page_table_sysctl[] = {
+static const struct ctl_table page_table_sysctl[] = {
        {
                .procname       = "allocate_pgste",
                .data           = &page_table_allocate_pgste,
index 76e4e74..f6d2d8a 100644 (file)
@@ -57,7 +57,7 @@ __setup_param("vdso=", vdso_setup, vdso32_setup, 0);
 /* Register vsyscall32 into the ABI table */
 #include <linux/sysctl.h>
 
-static struct ctl_table abi_table2[] = {
+static const struct ctl_table abi_table2[] = {
        {
                .procname       = "vsyscall32",
                .data           = &vdso32_enabled,
index 704e924..6cba85c 100644 (file)
@@ -49,7 +49,7 @@ static unsigned int sysctl_sld_mitigate = 1;
 static DEFINE_SEMAPHORE(buslock_sem, 1);
 
 #ifdef CONFIG_PROC_SYSCTL
-static struct ctl_table sld_sysctls[] = {
+static const struct ctl_table sld_sysctls[] = {
        {
                .procname       = "split_lock_mitigate",
                .data           = &sysctl_sld_mitigate,
index a58e775..2fa3a9e 100644 (file)
@@ -41,7 +41,7 @@ __setup("fips=", fips_enable);
 static char fips_name[] = FIPS_MODULE_NAME;
 static char fips_version[] = FIPS_MODULE_VERSION;
 
-static struct ctl_table crypto_sysctl_table[] = {
+static const struct ctl_table crypto_sysctl_table[] = {
        {
                .procname       = "fips_enabled",
                .data           = &fips_enabled,
index ddb70e2..c8afc50 100644 (file)
@@ -25,7 +25,7 @@ struct firmware_fallback_config fw_fallback_config = {
 EXPORT_SYMBOL_NS_GPL(fw_fallback_config, "FIRMWARE_LOADER_PRIVATE");
 
 #ifdef CONFIG_SYSCTL
-static struct ctl_table firmware_config_table[] = {
+static const struct ctl_table firmware_config_table[] = {
        {
                .procname       = "force_sysfs_fallback",
                .data           = &fw_fallback_config.force_sysfs_fallback,
index 51745ed..b163e04 100644 (file)
@@ -3612,7 +3612,7 @@ static int cdrom_sysctl_handler(const struct ctl_table *ctl, int write,
 }
 
 /* Place files in /proc/sys/dev/cdrom */
-static struct ctl_table cdrom_table[] = {
+static const struct ctl_table cdrom_table[] = {
        {
                .procname       = "info",
                .data           = &cdrom_sysctl_settings.info, 
index 48fe96a..e110857 100644 (file)
@@ -724,7 +724,7 @@ static int hpet_is_known(struct hpet_data *hdp)
        return 0;
 }
 
-static struct ctl_table hpet_table[] = {
+static const struct ctl_table hpet_table[] = {
        {
         .procname = "max-user-freq",
         .data = &hpet_max_freq,
index 05f17e3..e63c316 100644 (file)
@@ -650,7 +650,7 @@ static struct ipmi_smi_watcher smi_watcher = {
 #ifdef CONFIG_PROC_FS
 #include <linux/sysctl.h>
 
-static struct ctl_table ipmi_table[] = {
+static const struct ctl_table ipmi_table[] = {
        { .procname     = "poweroff_powercycle",
          .data         = &poweroff_powercycle,
          .maxlen       = sizeof(poweroff_powercycle),
index 23ee76b..2581186 100644 (file)
@@ -1665,7 +1665,7 @@ static int proc_do_rointvec(const struct ctl_table *table, int write, void *buf,
        return write ? 0 : proc_dointvec(table, 0, buf, lenp, ppos);
 }
 
-static struct ctl_table random_table[] = {
+static const struct ctl_table random_table[] = {
        {
                .procname       = "poolsize",
                .data           = &sysctl_poolsize,
index 2406cda..5384d1b 100644 (file)
@@ -4802,7 +4802,7 @@ err_unlock:
        return ret;
 }
 
-static struct ctl_table oa_table[] = {
+static const struct ctl_table oa_table[] = {
        {
         .procname = "perf_stream_paranoid",
         .data = &i915_perf_stream_paranoid,
index 8ec1b84..57cf01e 100644 (file)
@@ -56,7 +56,7 @@ int xe_observation_ioctl(struct drm_device *dev, void *data, struct drm_file *fi
        }
 }
 
-static struct ctl_table observation_ctl_table[] = {
+static const struct ctl_table observation_ctl_table[] = {
        {
         .procname = "observation_paranoid",
         .data = &xe_observation_paranoid,
index af5d1dc..f2e6f55 100644 (file)
@@ -141,7 +141,7 @@ static int sysctl_record_panic_msg = 1;
  * sysctl option to allow the user to control whether kmsg data should be
  * reported to Hyper-V on panic.
  */
-static struct ctl_table hv_ctl_table[] = {
+static const struct ctl_table hv_ctl_table[] = {
        {
                .procname       = "hyperv_record_panic_msg",
                .data           = &sysctl_record_panic_msg,
index 866015b..22f7bd3 100644 (file)
@@ -294,7 +294,7 @@ void mddev_destroy_serial_pool(struct mddev *mddev, struct md_rdev *rdev)
 
 static struct ctl_table_header *raid_table_header;
 
-static struct ctl_table raid_table[] = {
+static const struct ctl_table raid_table[] = {
        {
                .procname       = "speed_limit_min",
                .data           = &sysctl_speed_limit_min,
index 61b66e3..7a3c343 100644 (file)
@@ -93,7 +93,7 @@ int xpc_disengage_timelimit = XPC_DISENGAGE_DEFAULT_TIMELIMIT;
 static int xpc_disengage_min_timelimit;        /* = 0 */
 static int xpc_disengage_max_timelimit = 120;
 
-static struct ctl_table xpc_sys_xpc_hb[] = {
+static const struct ctl_table xpc_sys_xpc_hb[] = {
        {
         .procname = "hb_interval",
         .data = &xpc_hb_interval,
@@ -111,7 +111,7 @@ static struct ctl_table xpc_sys_xpc_hb[] = {
         .extra1 = &xpc_hb_check_min_interval,
         .extra2 = &xpc_hb_check_max_interval},
 };
-static struct ctl_table xpc_sys_xpc[] = {
+static const struct ctl_table xpc_sys_xpc[] = {
        {
         .procname = "disengage_timelimit",
         .data = &xpc_disengage_timelimit,
index b5cc11a..0e360fe 100644 (file)
@@ -1279,7 +1279,7 @@ static int armv8pmu_proc_user_access_handler(const struct ctl_table *table, int
        return 0;
 }
 
-static struct ctl_table armv8_pmu_sysctl_table[] = {
+static const struct ctl_table armv8_pmu_sysctl_table[] = {
        {
                .procname       = "perf_user_access",
                .data           = &sysctl_perf_user_access,
index 194c153..698de8d 100644 (file)
@@ -1317,7 +1317,7 @@ static int riscv_pmu_proc_user_access_handler(const struct ctl_table *table,
        return 0;
 }
 
-static struct ctl_table sbi_pmu_sysctl_table[] = {
+static const struct ctl_table sbi_pmu_sysctl_table[] = {
        {
                .procname       = "perf_user_access",
                .data           = &sysctl_perf_user_access,
index 093774d..be4aef0 100644 (file)
@@ -12,7 +12,7 @@
 #include "scsi_priv.h"
 
 
-static struct ctl_table scsi_table[] = {
+static const struct ctl_table scsi_table[] = {
        { .procname     = "logging_level",
          .data         = &scsi_logging_level,
          .maxlen       = sizeof(scsi_logging_level),
index 9412786..effb7e7 100644 (file)
@@ -1639,7 +1639,7 @@ MODULE_PARM_DESC(allow_dio, "allow direct I/O (default: 0 (disallow))");
 #ifdef CONFIG_SYSCTL
 #include <linux/sysctl.h>
 
-static struct ctl_table sg_sysctls[] = {
+static const struct ctl_table sg_sysctls[] = {
        {
                .procname       = "sg-big-buff",
                .data           = &sg_big_buff,
index 50c0c23..449dbd2 100644 (file)
@@ -3617,7 +3617,7 @@ void console_sysfs_notify(void)
                sysfs_notify(&consdev->kobj, NULL, "active");
 }
 
-static struct ctl_table tty_table[] = {
+static const struct ctl_table tty_table[] = {
        {
                .procname       = "legacy_tiocsti",
                .data           = &tty_legacy_tiocsti,
index 5283951..163f7f1 100644 (file)
@@ -84,7 +84,7 @@ module_param(balloon_boot_timeout, uint, 0444);
 #ifdef CONFIG_XEN_BALLOON_MEMORY_HOTPLUG
 static int xen_hotplug_unpopulated;
 
-static struct ctl_table balloon_table[] = {
+static const struct ctl_table balloon_table[] = {
        {
                .procname       = "hotplug_unpopulated",
                .data           = &xen_hotplug_unpopulated,
index 5067164..7b976b5 100644 (file)
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -224,7 +224,7 @@ static unsigned long aio_nr;                /* current system wide number of aio requests */
 static unsigned long aio_max_nr = 0x10000; /* system wide maximum number of aio requests */
 /*----end sysctl variables---*/
 #ifdef CONFIG_SYSCTL
-static struct ctl_table aio_sysctls[] = {
+static const struct ctl_table aio_sysctls[] = {
        {
                .procname       = "aio-nr",
                .data           = &aio_nr,
index 1715d5c..e341ade 100644 (file)
@@ -11,7 +11,7 @@
 unsigned int cachefiles_error_injection_state;
 
 static struct ctl_table_header *cachefiles_sysctl;
-static struct ctl_table cachefiles_sysctls[] = {
+static const struct ctl_table cachefiles_sysctls[] = {
        {
                .procname       = "error_injection",
                .data           = &cachefiles_error_injection_state,
index 9f2d574..0df46f0 100644 (file)
@@ -14,7 +14,7 @@
 
 static struct ctl_table_header *fs_table_header;
 
-static struct ctl_table coda_table[] = {
+static const struct ctl_table coda_table[] = {
        {
                .procname       = "timeout",
                .data           = &coda_timeout,
index d48edb3..591700e 100644 (file)
@@ -995,7 +995,7 @@ static int proc_dostring_coredump(const struct ctl_table *table, int write,
 static const unsigned int core_file_note_size_min = CORE_FILE_NOTE_SIZE_DEFAULT;
 static const unsigned int core_file_note_size_max = CORE_FILE_NOTE_SIZE_MAX;
 
-static struct ctl_table coredump_sysctls[] = {
+static const struct ctl_table coredump_sysctls[] = {
        {
                .procname       = "core_uses_pid",
                .data           = &core_uses_pid,
index 1a01d7a..1cd929f 100644 (file)
@@ -192,7 +192,7 @@ static int proc_nr_dentry(const struct ctl_table *table, int write, void *buffer
        return proc_doulongvec_minmax(table, write, buffer, lenp, ppos);
 }
 
-static struct ctl_table fs_dcache_sysctls[] = {
+static const struct ctl_table fs_dcache_sysctls[] = {
        {
                .procname       = "dentry-state",
                .data           = &dentry_stat,
index b20e565..1096ff8 100644 (file)
@@ -45,7 +45,7 @@ static int pty_limit_min;
 static int pty_limit_max = INT_MAX;
 static atomic_t pty_count = ATOMIC_INIT(0);
 
-static struct ctl_table pty_table[] = {
+static const struct ctl_table pty_table[] = {
        {
                .procname       = "max",
                .maxlen         = sizeof(int),
index f9898e6..7c0980d 100644 (file)
@@ -318,7 +318,7 @@ static void unlist_file(struct epitems_head *head)
 static long long_zero;
 static long long_max = LONG_MAX;
 
-static struct ctl_table epoll_table[] = {
+static const struct ctl_table epoll_table[] = {
        {
                .procname       = "max_user_watches",
                .data           = &max_user_watches,
index a498391..506cd41 100644 (file)
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -2159,7 +2159,7 @@ static int proc_dointvec_minmax_coredump(const struct ctl_table *table, int writ
        return error;
 }
 
-static struct ctl_table fs_exec_sysctls[] = {
+static const struct ctl_table fs_exec_sysctls[] = {
        {
                .procname       = "suid_dumpable",
                .data           = &suid_dumpable,
index a32171d..7f7c378 100644 (file)
@@ -106,7 +106,7 @@ static int proc_nr_files(const struct ctl_table *table, int write, void *buffer,
        return proc_doulongvec_minmax(table, write, buffer, lenp, ppos);
 }
 
-static struct ctl_table fs_stat_sysctls[] = {
+static const struct ctl_table fs_stat_sysctls[] = {
        {
                .procname       = "file-nr",
                .data           = &files_stat,
index b272bb3..63fb1e5 100644 (file)
@@ -13,7 +13,7 @@ static struct ctl_table_header *fuse_table_header;
 /* Bound by fuse_init_out max_pages, which is a u16 */
 static unsigned int sysctl_fuse_max_pages_limit = 65535;
 
-static struct ctl_table fuse_sysctl_table[] = {
+static const struct ctl_table fuse_sysctl_table[] = {
        {
                .procname       = "max_pages_limit",
                .data           = &fuse_max_pages_limit,
index 6b4c772..5587aab 100644 (file)
@@ -184,7 +184,7 @@ static int proc_nr_inodes(const struct ctl_table *table, int write, void *buffer
        return proc_doulongvec_minmax(table, write, buffer, lenp, ppos);
 }
 
-static struct ctl_table inodes_sysctls[] = {
+static const struct ctl_table inodes_sysctls[] = {
        {
                .procname       = "inode-nr",
                .data           = &inodes_stat,
index 7ded57e..2c8eedc 100644 (file)
@@ -412,7 +412,7 @@ EXPORT_SYMBOL_GPL(lockd_down);
  * Sysctl parameters (same as module parameters, different interface).
  */
 
-static struct ctl_table nlm_sysctls[] = {
+static const struct ctl_table nlm_sysctls[] = {
        {
                .procname       = "nlm_grace_period",
                .data           = &nlm_grace_period,
index 25afc8d..1619cdd 100644 (file)
@@ -97,7 +97,7 @@ static int leases_enable = 1;
 static int lease_break_time = 45;
 
 #ifdef CONFIG_SYSCTL
-static struct ctl_table locks_sysctls[] = {
+static const struct ctl_table locks_sysctls[] = {
        {
                .procname       = "leases-enable",
                .data           = &leases_enable,
index e56c29a..8c82afd 100644 (file)
@@ -1099,7 +1099,7 @@ static int sysctl_protected_fifos __read_mostly;
 static int sysctl_protected_regular __read_mostly;
 
 #ifdef CONFIG_SYSCTL
-static struct ctl_table namei_sysctls[] = {
+static const struct ctl_table namei_sysctls[] = {
        {
                .procname       = "protected_symlinks",
                .data           = &sysctl_protected_symlinks,
index 4013fba..a3ed3f2 100644 (file)
@@ -5985,7 +5985,7 @@ const struct proc_ns_operations mntns_operations = {
 };
 
 #ifdef CONFIG_SYSCTL
-static struct ctl_table fs_namespace_sysctls[] = {
+static const struct ctl_table fs_namespace_sysctls[] = {
        {
                .procname       = "mount-max",
                .data           = &sysctl_mount_max,
index 886a7c4..d1a92d8 100644 (file)
@@ -17,7 +17,7 @@ static const int nfs_set_port_min;
 static const int nfs_set_port_max = 65535;
 static struct ctl_table_header *nfs4_callback_sysctl_table;
 
-static struct ctl_table nfs4_cb_sysctls[] = {
+static const struct ctl_table nfs4_cb_sysctls[] = {
        {
                .procname = "nfs_callback_tcpport",
                .data = &nfs_callback_set_tcpport,
index e645be1..f579df0 100644 (file)
@@ -14,7 +14,7 @@
 
 static struct ctl_table_header *nfs_callback_sysctl_table;
 
-static struct ctl_table nfs_cb_sysctls[] = {
+static const struct ctl_table nfs_cb_sysctls[] = {
        {
                .procname       = "nfs_mountpoint_timeout",
                .data           = &nfs_mountpoint_expiry_timeout,
index 6004dfd..c4cdaf5 100644 (file)
@@ -20,7 +20,7 @@
 
 static int dir_notify_enable __read_mostly = 1;
 #ifdef CONFIG_SYSCTL
-static struct ctl_table dnotify_sysctls[] = {
+static const struct ctl_table dnotify_sysctls[] = {
        {
                .procname       = "dir-notify-enable",
                .data           = &dir_notify_enable,
index 6ff94e3..ba3e2d0 100644 (file)
@@ -58,7 +58,7 @@ static int fanotify_max_queued_events __read_mostly;
 static long ft_zero = 0;
 static long ft_int_max = INT_MAX;
 
-static struct ctl_table fanotify_table[] = {
+static const struct ctl_table fanotify_table[] = {
        {
                .procname       = "max_user_groups",
                .data   = &init_user_ns.ucount_max[UCOUNT_FANOTIFY_GROUPS],
index e0c4895..b372fb2 100644 (file)
@@ -58,7 +58,7 @@ struct kmem_cache *inotify_inode_mark_cachep __ro_after_init;
 static long it_zero = 0;
 static long it_int_max = INT_MAX;
 
-static struct ctl_table inotify_table[] = {
+static const struct ctl_table inotify_table[] = {
        {
                .procname       = "max_user_instances",
                .data           = &init_user_ns.ucount_max[UCOUNT_INOTIFY_INSTANCES],
index 20aa37b..ddd761c 100644 (file)
@@ -650,7 +650,7 @@ error:
  * and easier to preserve the name.
  */
 
-static struct ctl_table ocfs2_nm_table[] = {
+static const struct ctl_table ocfs2_nm_table[] = {
        {
                .procname       = "hb_ctl_path",
                .data           = ocfs2_hb_ctl_path,
index 82fede0..94b5904 100644 (file)
--- a/fs/pipe.c
+++ b/fs/pipe.c
@@ -1478,7 +1478,7 @@ static int proc_dopipe_max_size(const struct ctl_table *table, int write,
                                 do_proc_dopipe_max_size_conv, NULL);
 }
 
-static struct ctl_table fs_pipe_sysctls[] = {
+static const struct ctl_table fs_pipe_sysctls[] = {
        {
                .procname       = "pipe-max-size",
                .data           = &pipe_max_size,
index f957891..825c5c2 100644 (file)
@@ -2926,7 +2926,7 @@ static int do_proc_dqstats(const struct ctl_table *table, int write,
        return proc_doulongvec_minmax(table, write, buffer, lenp, ppos);
 }
 
-static struct ctl_table fs_dqstats_table[] = {
+static const struct ctl_table fs_dqstats_table[] = {
        {
                .procname       = "lookups",
                .data           = &dqstats.stat[DQST_LOOKUPS],
index 8dbde9a..ad429df 100644 (file)
@@ -7,7 +7,7 @@
 #include <linux/init.h>
 #include <linux/sysctl.h>
 
-static struct ctl_table fs_shared_sysctls[] = {
+static const struct ctl_table fs_shared_sysctls[] = {
        {
                .procname       = "overflowuid",
                .data           = &fs_overflowuid,
index 7c0bd0b..97c4d71 100644 (file)
@@ -36,7 +36,7 @@
 static int sysctl_unprivileged_userfaultfd __read_mostly;
 
 #ifdef CONFIG_SYSCTL
-static struct ctl_table vm_userfaultfd_table[] = {
+static const struct ctl_table vm_userfaultfd_table[] = {
        {
                .procname       = "unprivileged_userfaultfd",
                .data           = &sysctl_unprivileged_userfaultfd,
index f440f0e..6e8d33b 100644 (file)
@@ -10,7 +10,7 @@
 #include <linux/ratelimit.h>
 
 #ifdef CONFIG_SYSCTL
-static struct ctl_table fsverity_sysctl_table[] = {
+static const struct ctl_table fsverity_sysctl_table[] = {
 #ifdef CONFIG_FS_VERITY_BUILTIN_SIGNATURES
        {
                .procname       = "require_signatures",
index c84df23..751dc74 100644 (file)
@@ -66,7 +66,7 @@ xfs_deprecated_dointvec_minmax(
        return proc_dointvec_minmax(ctl, write, buffer, lenp, ppos);
 }
 
-static struct ctl_table xfs_table[] = {
+static const struct ctl_table xfs_table[] = {
        {
                .procname       = "irix_sgid_inherit",
                .data           = &xfs_params.sgid_inherit.val,
index f86ef92..f6867ba 100644 (file)
@@ -21,7 +21,7 @@ phys_addr_t phys_initrd_start __initdata;
 unsigned long phys_initrd_size __initdata;
 
 #ifdef CONFIG_SYSCTL
-static struct ctl_table kern_do_mounts_initrd_table[] = {
+static const struct ctl_table kern_do_mounts_initrd_table[] = {
        {
                .procname       = "real-root-dev",
                .data           = &real_root_dev,
index 7bfbc7c..5a0f8a5 100644 (file)
@@ -157,7 +157,7 @@ static int __read_mostly sysctl_io_uring_disabled;
 static int __read_mostly sysctl_io_uring_group = -1;
 
 #ifdef CONFIG_SYSCTL
-static struct ctl_table kernel_io_uring_disabled_table[] = {
+static const struct ctl_table kernel_io_uring_disabled_table[] = {
        {
                .procname       = "io_uring_disabled",
                .data           = &sysctl_io_uring_disabled,
index 54318e0..15b17e8 100644 (file)
@@ -73,7 +73,7 @@ int ipc_mni = IPCMNI;
 int ipc_mni_shift = IPCMNI_SHIFT;
 int ipc_min_cycle = RADIX_TREE_MAP_SIZE;
 
-static struct ctl_table ipc_sysctls[] = {
+static const struct ctl_table ipc_sysctls[] = {
        {
                .procname       = "shmmax",
                .data           = &init_ipc_ns.shm_ctlmax,
index b70dc2f..0dd12e1 100644 (file)
@@ -20,7 +20,7 @@ static int msg_max_limit_max = HARD_MSGMAX;
 static int msg_maxsize_limit_min = MIN_MSGSIZEMAX;
 static int msg_maxsize_limit_max = HARD_MSGSIZEMAX;
 
-static struct ctl_table mq_sysctls[] = {
+static const struct ctl_table mq_sysctls[] = {
        {
                .procname       = "queues_max",
                .data           = &init_ipc_ns.mq_queues_max,
index 179848a..31222e8 100644 (file)
@@ -76,7 +76,7 @@ static int acct_parm[3] = {4, 2, 30};
 #define ACCT_TIMEOUT   (acct_parm[2])  /* foo second timeout between checks */
 
 #ifdef CONFIG_SYSCTL
-static struct ctl_table kern_acct_table[] = {
+static const struct ctl_table kern_acct_table[] = {
        {
                .procname       = "acct",
                .data           = &acct_parm,
index 0daf098..c420edb 100644 (file)
@@ -6128,7 +6128,7 @@ static int bpf_unpriv_handler(const struct ctl_table *table, int write,
        return ret;
 }
 
-static struct ctl_table bpf_syscall_table[] = {
+static const struct ctl_table bpf_syscall_table[] = {
        {
                .procname       = "unprivileged_bpf_disabled",
                .data           = &sysctl_unprivileged_bpf_disabled,
index b238eb8..eb63a02 100644 (file)
@@ -64,7 +64,7 @@ static int sysctl_delayacct(const struct ctl_table *table, int write, void *buff
        return err;
 }
 
-static struct ctl_table kern_delayacct_table[] = {
+static const struct ctl_table kern_delayacct_table[] = {
        {
                .procname       = "task_delayacct",
                .data           = NULL,
index 1dcddfe..3485e5f 100644 (file)
@@ -85,7 +85,7 @@
 static unsigned int oops_limit = 10000;
 
 #ifdef CONFIG_SYSCTL
-static struct ctl_table kern_exit_table[] = {
+static const struct ctl_table kern_exit_table[] = {
        {
                .procname       = "oops_limit",
                .data           = &oops_limit,
index 9531698..04efa7a 100644 (file)
@@ -274,7 +274,7 @@ static int proc_dohung_task_timeout_secs(const struct ctl_table *table, int writ
  * and hung_task_check_interval_secs
  */
 static const unsigned long hung_task_timeout_max = (LONG_MAX / HZ);
-static struct ctl_table hung_task_sysctls[] = {
+static const struct ctl_table hung_task_sysctls[] = {
 #ifdef CONFIG_SMP
        {
                .procname       = "hung_task_all_cpu_backtrace",
index b424a5c..c0bdc16 100644 (file)
@@ -925,7 +925,7 @@ static int kexec_limit_handler(const struct ctl_table *table, int write,
        return proc_dointvec(&tmp, write, buffer, lenp, ppos);
 }
 
-static struct ctl_table kexec_core_sysctls[] = {
+static const struct ctl_table kexec_core_sysctls[] = {
        {
                .procname       = "kexec_load_disabled",
                .data           = &kexec_load_disabled,
index 0305692..88aeac8 100644 (file)
@@ -946,7 +946,7 @@ static int proc_kprobes_optimization_handler(const struct ctl_table *table,
        return ret;
 }
 
-static struct ctl_table kprobe_sysctls[] = {
+static const struct ctl_table kprobe_sysctls[] = {
        {
                .procname       = "kprobes-optimization",
                .data           = &sysctl_kprobes_optimization,
index 77ee3ea..d4281d1 100644 (file)
@@ -77,7 +77,7 @@ static int sysctl_latencytop(const struct ctl_table *table, int write, void *buf
        return err;
 }
 
-static struct ctl_table latencytop_sysctl[] = {
+static const struct ctl_table latencytop_sysctl[] = {
        {
                .procname   = "latencytop",
                .data       = &latencytop_enabled,
index 29acd23..4470680 100644 (file)
@@ -79,7 +79,7 @@ module_param(lock_stat, int, 0644);
 #endif
 
 #ifdef CONFIG_SYSCTL
-static struct ctl_table kern_lockdep_table[] = {
+static const struct ctl_table kern_lockdep_table[] = {
 #ifdef CONFIG_PROVE_LOCKING
        {
                .procname       = "prove_locking",
index fbc59b3..d8635d5 100644 (file)
@@ -84,7 +84,7 @@ ATOMIC_NOTIFIER_HEAD(panic_notifier_list);
 EXPORT_SYMBOL(panic_notifier_list);
 
 #ifdef CONFIG_SYSCTL
-static struct ctl_table kern_panic_table[] = {
+static const struct ctl_table kern_panic_table[] = {
 #ifdef CONFIG_SMP
        {
                .procname       = "oops_all_cpu_backtrace",
index 3a10a7b..9240847 100644 (file)
@@ -695,7 +695,7 @@ static struct ctl_table_root pid_table_root = {
        .set_ownership  = pid_table_root_set_ownership,
 };
 
-static struct ctl_table pid_table[] = {
+static const struct ctl_table pid_table[] = {
        {
                .procname       = "pid_max",
                .data           = &init_pid_ns.pid_max,
index f1ffa03..8f6cfec 100644 (file)
@@ -303,7 +303,7 @@ static int pid_ns_ctl_handler(const struct ctl_table *table, int write,
        return ret;
 }
 
-static struct ctl_table pid_ns_ctl_table[] = {
+static const struct ctl_table pid_ns_ctl_table[] = {
        {
                .procname = "ns_last_pid",
                .maxlen = sizeof(int),
index 18ecaef..5d8f981 100644 (file)
@@ -31,7 +31,7 @@ static int pid_mfd_noexec_dointvec_minmax(const struct ctl_table *table,
        return err;
 }
 
-static struct ctl_table pid_ns_ctl_table_vm[] = {
+static const struct ctl_table pid_ns_ctl_table_vm[] = {
        {
                .procname       = "memfd_noexec",
                .data           = &init_pid_ns.memfd_noexec_scope,
index f5072dc..da77f3f 100644 (file)
@@ -20,7 +20,7 @@ static int proc_dointvec_minmax_sysadmin(const struct ctl_table *table, int writ
        return proc_dointvec_minmax(table, write, buffer, lenp, ppos);
 }
 
-static struct ctl_table printk_sysctls[] = {
+static const struct ctl_table printk_sysctls[] = {
        {
                .procname       = "printk",
                .data           = &console_loglevel,
index a701000..b5a8569 100644 (file)
@@ -1287,7 +1287,7 @@ static struct attribute *reboot_attrs[] = {
 };
 
 #ifdef CONFIG_SYSCTL
-static struct ctl_table kern_reboot_table[] = {
+static const struct ctl_table kern_reboot_table[] = {
        {
                .procname       = "poweroff_cmd",
                .data           = &poweroff_cmd,
index db68a96..83d46b9 100644 (file)
@@ -9,7 +9,7 @@ static struct autogroup autogroup_default;
 static atomic_t autogroup_seq_nr;
 
 #ifdef CONFIG_SYSCTL
-static struct ctl_table sched_autogroup_sysctls[] = {
+static const struct ctl_table sched_autogroup_sysctls[] = {
        {
                .procname       = "sched_autogroup_enabled",
                .data           = &sysctl_sched_autogroup_enabled,
index 9142a03..165c90b 100644 (file)
@@ -4654,7 +4654,7 @@ static int sysctl_schedstats(const struct ctl_table *table, int write, void *buf
 #endif /* CONFIG_SCHEDSTATS */
 
 #ifdef CONFIG_SYSCTL
-static struct ctl_table sched_core_sysctls[] = {
+static const struct ctl_table sched_core_sysctls[] = {
 #ifdef CONFIG_SCHEDSTATS
        {
                .procname       = "sched_schedstats",
index 62192ac..38e4537 100644 (file)
@@ -26,7 +26,7 @@
 static unsigned int sysctl_sched_dl_period_max = 1 << 22; /* ~4 seconds */
 static unsigned int sysctl_sched_dl_period_min = 100;     /* 100 us */
 #ifdef CONFIG_SYSCTL
-static struct ctl_table sched_dl_sysctls[] = {
+static const struct ctl_table sched_dl_sysctls[] = {
        {
                .procname       = "sched_deadline_period_max_us",
                .data           = &sysctl_sched_dl_period_max,
index 1e78caa..ce2e94c 100644 (file)
@@ -133,7 +133,7 @@ static unsigned int sysctl_numa_balancing_promote_rate_limit = 65536;
 #endif
 
 #ifdef CONFIG_SYSCTL
-static struct ctl_table sched_fair_sysctls[] = {
+static const struct ctl_table sched_fair_sysctls[] = {
 #ifdef CONFIG_CFS_BANDWIDTH
        {
                .procname       = "sched_cfs_bandwidth_slice_us",
index bd66a46..4b8e33c 100644 (file)
@@ -26,7 +26,7 @@ static int sched_rt_handler(const struct ctl_table *table, int write, void *buff
                size_t *lenp, loff_t *ppos);
 static int sched_rr_handler(const struct ctl_table *table, int write, void *buffer,
                size_t *lenp, loff_t *ppos);
-static struct ctl_table sched_rt_sysctls[] = {
+static const struct ctl_table sched_rt_sysctls[] = {
        {
                .procname       = "sched_rt_period_us",
                .data           = &sysctl_sched_rt_period,
index da33ec9..c49aea8 100644 (file)
@@ -312,7 +312,7 @@ static int sched_energy_aware_handler(const struct ctl_table *table, int write,
        return ret;
 }
 
-static struct ctl_table sched_energy_aware_sysctls[] = {
+static const struct ctl_table sched_energy_aware_sysctls[] = {
        {
                .procname       = "sched_energy_aware",
                .data           = &sysctl_sched_energy_aware,
index 385d482..f59381c 100644 (file)
@@ -2450,7 +2450,7 @@ static int seccomp_actions_logged_handler(const struct ctl_table *ro_table, int
        return ret;
 }
 
-static struct ctl_table seccomp_sysctl_table[] = {
+static const struct ctl_table seccomp_sysctl_table[] = {
        {
                .procname       = "actions_avail",
                .data           = (void *) &seccomp_actions_avail,
index a2afd54..875e97f 100644 (file)
@@ -4950,7 +4950,7 @@ static inline void siginfo_buildtime_checks(void)
 }
 
 #if defined(CONFIG_SYSCTL)
-static struct ctl_table signal_debug_table[] = {
+static const struct ctl_table signal_debug_table[] = {
 #ifdef CONFIG_SYSCTL_EXCEPTION_TRACE
        {
                .procname       = "exception-trace",
index 0f4804f..bb65321 100644 (file)
@@ -45,7 +45,7 @@ static int stack_erasing_sysctl(const struct ctl_table *table, int write,
                                        str_enabled_disabled(state));
        return ret;
 }
-static struct ctl_table stackleak_sysctls[] = {
+static const struct ctl_table stackleak_sysctls[] = {
        {
                .procname       = "stack_erasing",
                .data           = NULL,
index 3ac98bb..eb2842b 100644 (file)
@@ -374,7 +374,7 @@ static void sysctl_test_register_sysctl_sz_invalid_extra_value(
                struct kunit *test)
 {
        unsigned char data = 0;
-       struct ctl_table table_foo[] = {
+       const struct ctl_table table_foo[] = {
                {
                        .procname       = "foo",
                        .data           = &data,
@@ -386,7 +386,7 @@ static void sysctl_test_register_sysctl_sz_invalid_extra_value(
                },
        };
 
-       struct ctl_table table_bar[] = {
+       const struct ctl_table table_bar[] = {
                {
                        .procname       = "bar",
                        .data           = &data,
@@ -398,7 +398,7 @@ static void sysctl_test_register_sysctl_sz_invalid_extra_value(
                },
        };
 
-       struct ctl_table table_qux[] = {
+       const struct ctl_table table_qux[] = {
                {
                        .procname       = "qux",
                        .data           = &data,
index 7ae7a41..cb57da4 100644 (file)
@@ -1609,7 +1609,7 @@ int proc_do_static_key(const struct ctl_table *table, int write,
        return ret;
 }
 
-static struct ctl_table kern_table[] = {
+static const struct ctl_table kern_table[] = {
        {
                .procname       = "panic",
                .data           = &panic_timeout,
@@ -2021,7 +2021,7 @@ static struct ctl_table kern_table[] = {
 #endif
 };
 
-static struct ctl_table vm_table[] = {
+static const struct ctl_table vm_table[] = {
        {
                .procname       = "overcommit_memory",
                .data           = &sysctl_overcommit_memory,
index 40706cb..c8f776d 100644 (file)
@@ -301,7 +301,7 @@ static int timer_migration_handler(const struct ctl_table *table, int write,
        return ret;
 }
 
-static struct ctl_table timer_sysctl[] = {
+static const struct ctl_table timer_sysctl[] = {
        {
                .procname       = "timer_migration",
                .data           = &sysctl_timer_migration,
index f79eb93..728ecda 100644 (file)
@@ -8780,7 +8780,7 @@ ftrace_enable_sysctl(const struct ctl_table *table, int write,
        return 0;
 }
 
-static struct ctl_table ftrace_sysctls[] = {
+static const struct ctl_table ftrace_sysctls[] = {
        {
                .procname       = "ftrace_enabled",
                .data           = &ftrace_enabled,
index 17bcad8..97325fb 100644 (file)
@@ -2899,7 +2899,7 @@ static int set_max_user_events_sysctl(const struct ctl_table *table, int write,
        return ret;
 }
 
-static struct ctl_table user_event_sysctls[] = {
+static const struct ctl_table user_event_sysctls[] = {
        {
                .procname       = "user_events_max",
                .data           = &max_user_events,
index be92342..b4da45a 100644 (file)
@@ -544,7 +544,7 @@ static int proc_cap_handler(const struct ctl_table *table, int write,
        return 0;
 }
 
-static struct ctl_table usermodehelper_table[] = {
+static const struct ctl_table usermodehelper_table[] = {
        {
                .procname       = "bset",
                .data           = &usermodehelper_bset,
index 7282f61..bfbaaec 100644 (file)
@@ -75,7 +75,7 @@ static DEFINE_CTL_TABLE_POLL(hostname_poll);
 static DEFINE_CTL_TABLE_POLL(domainname_poll);
 
 // Note: update 'enum uts_proc' to match any changes to this table
-static struct ctl_table uts_kern_table[] = {
+static const struct ctl_table uts_kern_table[] = {
        {
                .procname       = "arch",
                .data           = init_uts_ns.name.machine,
@@ -129,7 +129,7 @@ static struct ctl_table uts_kern_table[] = {
  */
 void uts_proc_notify(enum uts_proc proc)
 {
-       struct ctl_table *table = &uts_kern_table[proc];
+       const struct ctl_table *table = &uts_kern_table[proc];
 
        proc_sys_poll_notify(table->poll);
 }
index 177abb7..b2da7de 100644 (file)
@@ -1094,7 +1094,7 @@ static int proc_watchdog_cpumask(const struct ctl_table *table, int write,
 
 static const int sixty = 60;
 
-static struct ctl_table watchdog_sysctls[] = {
+static const struct ctl_table watchdog_sysctls[] = {
        {
                .procname       = "watchdog",
                .data           = &watchdog_user_enabled,
index b6696fa..4249e0c 100644 (file)
@@ -71,7 +71,7 @@ static struct test_sysctl_data test_data = {
 };
 
 /* These are all under /proc/sys/debug/test_sysctl/ */
-static struct ctl_table test_table[] = {
+static const struct ctl_table test_table[] = {
        {
                .procname       = "int_0001",
                .data           = &test_data.int_0001,
@@ -177,7 +177,7 @@ static int test_sysctl_setup_node_tests(void)
 }
 
 /* Used to test that unregister actually removes the directory */
-static struct ctl_table test_table_unregister[] = {
+static const struct ctl_table test_table_unregister[] = {
        {
                .procname       = "unregister_error",
                .data           = &test_data.int_0001,
@@ -220,7 +220,7 @@ static int test_sysctl_run_register_mount_point(void)
        return 0;
 }
 
-static struct ctl_table test_table_empty[] = { };
+static const struct ctl_table test_table_empty[] = { };
 
 static int test_sysctl_run_register_empty(void)
 {
index 73e80b2..bcc0df0 100644 (file)
@@ -3272,7 +3272,7 @@ static int proc_dointvec_minmax_warn_RT_change(const struct ctl_table *table,
        return ret;
 }
 
-static struct ctl_table vm_compaction[] = {
+static const struct ctl_table vm_compaction[] = {
        {
                .procname       = "compact_memory",
                .data           = &sysctl_compact_memory,
index 87761b0..3b25b69 100644 (file)
@@ -4867,7 +4867,7 @@ out:
        return ret;
 }
 
-static struct ctl_table hugetlb_table[] = {
+static const struct ctl_table hugetlb_table[] = {
        {
                .procname       = "nr_hugepages",
                .data           = NULL,
index 57b7f59..7735972 100644 (file)
@@ -693,7 +693,7 @@ void hugetlb_vmemmap_optimize_folios(struct hstate *h, struct list_head *folio_l
        free_vmemmap_page_list(&vmemmap_pages);
 }
 
-static struct ctl_table hugetlb_vmemmap_sysctls[] = {
+static const struct ctl_table hugetlb_vmemmap_sysctls[] = {
        {
                .procname       = "hugetlb_optimize_vmemmap",
                .data           = &vmemmap_optimize_enabled,
index a7b8ccd..995a15e 100644 (file)
@@ -124,7 +124,7 @@ const struct attribute_group memory_failure_attr_group = {
        .attrs = memory_failure_attr,
 };
 
-static struct ctl_table memory_failure_table[] = {
+static const struct ctl_table memory_failure_table[] = {
        {
                .procname       = "memory_failure_early_kill",
                .data           = &sysctl_memory_failure_early_kill,
index 044ebab..1cf121a 100644 (file)
@@ -705,7 +705,7 @@ static void queue_oom_reaper(struct task_struct *tsk)
 }
 
 #ifdef CONFIG_SYSCTL
-static struct ctl_table vm_oom_kill_table[] = {
+static const struct ctl_table vm_oom_kill_table[] = {
        {
                .procname       = "panic_on_oom",
                .data           = &sysctl_panic_on_oom,
index 4f59707..eb55ece 100644 (file)
@@ -2298,7 +2298,7 @@ static int page_writeback_cpu_online(unsigned int cpu)
 /* this is needed for the proc_doulongvec_minmax of vm_dirty_bytes */
 static const unsigned long dirty_bytes_min = 2 * PAGE_SIZE;
 
-static struct ctl_table vm_page_writeback_sysctls[] = {
+static const struct ctl_table vm_page_writeback_sysctls[] = {
        {
                .procname   = "dirty_background_ratio",
                .data       = &dirty_background_ratio,
index 6e469c7..5797896 100644 (file)
@@ -6166,7 +6166,7 @@ out:
        return ret;
 }
 
-static struct ctl_table page_alloc_sysctl_table[] = {
+static const struct ctl_table page_alloc_sysctl_table[] = {
        {
                .procname       = "min_free_kbytes",
                .data           = &min_free_kbytes,
index 1edc128..9b6c2f1 100644 (file)
@@ -2038,7 +2038,7 @@ static int apparmor_dointvec(const struct ctl_table *table, int write,
        return proc_dointvec(table, write, buffer, lenp, ppos);
 }
 
-static struct ctl_table apparmor_sysctl_table[] = {
+static const struct ctl_table apparmor_sysctl_table[] = {
 #ifdef CONFIG_USER_NS
        {
                .procname       = "unprivileged_userns_apparmor_policy",
index 91f000e..cde08c4 100644 (file)
@@ -9,7 +9,7 @@
 #include <linux/sysctl.h>
 #include "internal.h"
 
-static struct ctl_table key_sysctls[] = {
+static const struct ctl_table key_sysctls[] = {
        {
                .procname = "maxkeys",
                .data = &key_quota_maxkeys,
index 1a2d02f..1971710 100644 (file)
@@ -452,7 +452,7 @@ static int yama_dointvec_minmax(const struct ctl_table *table, int write,
 
 static int max_scope = YAMA_SCOPE_NO_ATTACH;
 
-static struct ctl_table yama_sysctl_table[] = {
+static const struct ctl_table yama_sysctl_table[] = {
        {
                .procname       = "ptrace_scope",
                .data           = &ptrace_scope,