1
0
Fork 0
mirror of synced 2025-03-06 20:59:54 +01:00
linux/drivers/char
Joel Granados 1751f872cc treewide: const qualify ctl_tables where applicable
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 78eb4ea25c ("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>
2025-01-28 13:48:37 +01:00
..
agp Char/Misc and other driver changes for 6.11-rc1 2024-07-19 15:55:08 -07:00
hw_random hwrng: amd - remove reference to removed PPC_MAPLE config 2024-11-15 19:52:51 +08:00
ipmi treewide: const qualify ctl_tables where applicable 2025-01-28 13:48:37 +01:00
mwave char/mwave: Adjust io port register size 2021-12-03 14:27:06 +01:00
tpm tpm: Change to kvalloc() in eventlog/acpi.c 2025-01-23 10:52:23 +02:00
xilinx_hwicap char: Switch back to struct platform_driver::remove() 2024-11-05 05:33:47 +01:00
xillybus char: Switch back to struct platform_driver::remove() 2024-11-05 05:33:47 +01:00
adi.c vfs-6.12.file 2024-09-16 09:14:02 +02:00
apm-emulation.c apm-emulation: drop unexpected word "the" in the comments 2022-06-27 16:15:27 +02:00
applicom.c [tree-wide] finally take no_llseek out 2024-09-27 08:18:43 -07:00
applicom.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
bsr.c bsr: add missing MODULE_DESCRIPTION() macro 2024-07-03 16:40:53 +02:00
ds1620.c [tree-wide] finally take no_llseek out 2024-09-27 08:18:43 -07:00
dsp56k.c dsp56k: add missing MODULE_DESCRIPTION() macro 2024-07-03 16:40:26 +02:00
dtlk.c [tree-wide] finally take no_llseek out 2024-09-27 08:18:43 -07:00
hangcheck-timer.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 405 2019-06-05 17:37:13 +02:00
hpet.c treewide: const qualify ctl_tables where applicable 2025-01-28 13:48:37 +01:00
Kconfig ACPI: EC: make EC support compile-time conditional 2024-10-24 17:47:15 +02:00
lp.c parport: Remove parport_driver.devmodel 2024-07-03 16:44:22 +02:00
Makefile arch: Remove Itanium (IA-64) architecture 2023-09-11 08:13:17 +00:00
mem.c fs: move FMODE_UNSIGNED_OFFSET to fop_flags 2024-08-30 08:22:36 +02:00
misc.c misc: misc_minor_alloc to use ida for all dynamic/misc dynamic minors 2025-01-08 13:18:10 +01:00
nsc_gpio.c treewide: Add SPDX license identifier for more missed files 2019-05-21 10:50:45 +02:00
nvram.c char: add missing MODULE_DESCRIPTION() macros 2024-06-04 17:40:17 +02:00
nwbutton.c char: add missing NetWinder MODULE_DESCRIPTION() macros 2024-07-31 13:47:45 +02:00
nwbutton.h misc: cleanup minor number definitions in c file into miscdevice.h 2020-03-18 12:27:03 +01:00
nwflash.c char: add missing NetWinder MODULE_DESCRIPTION() macros 2024-07-31 13:47:45 +02:00
pc8736x_gpio.c [tree-wide] finally take no_llseek out 2024-09-27 08:18:43 -07:00
powernv-op-panel.c char: Switch back to struct platform_driver::remove() 2024-11-05 05:33:47 +01:00
ppdev.c [tree-wide] finally take no_llseek out 2024-09-27 08:18:43 -07:00
ps3flash.c powerpc/ps3: make system bus's remove and shutdown callbacks return void 2020-12-04 01:01:22 +11:00
random.c treewide: const qualify ctl_tables where applicable 2025-01-28 13:48:37 +01:00
scx200_gpio.c [tree-wide] finally take no_llseek out 2024-09-27 08:18:43 -07:00
sonypi.c char: Switch back to struct platform_driver::remove() 2024-11-05 05:33:47 +01:00
tlclk.c tlclk: add missing MODULE_DESCRIPTION() macro 2024-06-04 17:40:14 +02:00
toshiba.c module: remove never implemented MODULE_SUPPORTED_DEVICE 2021-03-17 13:16:18 -07:00
ttyprintk.c char: add missing MODULE_DESCRIPTION() macros 2024-06-04 17:40:17 +02:00
uv_mmtimer.c BKL: remove extraneous #include <smp_lock.h> 2010-11-17 08:59:32 -08:00
virtio_console.c virtio: console: Replace deprecated kmap_atomic with kmap_local_page 2025-01-10 16:12:38 +01:00