Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

macintosh: declare ctl_table as const

Since commit 7abc9b53bd51 ("sysctl: allow registration of const struct
ctl_table"), the sysctl registration API allows struct ctl_table variables
to be placed into read-only memory.

mac_hid_files is registered as a sysctl table and should be treated as
read-only. By declaring the mac_hid_files structure as const, we ensure
that it cannot be accidentally modified. This change improves safety.

Suggested-by: Thomas Weißschuh <linux@weissschuh.net>
Suggested-by: Ricardo B. Marliere <rbm@suse.com>
Reviewed-by: Ricardo B. Marliere <rbm@suse.com>
Signed-off-by: Luis Felipe Hernandez <luis.hernandez093@gmail.com>
Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Link: https://patch.msgid.link/20241217-constify_ctl_table-v1-1-402ebceaeb8e@gmail.com

authored by

Luis Felipe Hernandez and committed by
Madhavan Srinivasan
e8341668 65f50383

+1 -1
+1 -1
drivers/macintosh/mac_hid.c
··· 215 215 } 216 216 217 217 /* file(s) in /proc/sys/dev/mac_hid */ 218 - static struct ctl_table mac_hid_files[] = { 218 + static const struct ctl_table mac_hid_files[] = { 219 219 { 220 220 .procname = "mouse_button_emulation", 221 221 .data = &mouse_emulate_buttons,