mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-12-27 12:21:22 -05:00
macintosh: declare ctl_table as const
Since commit 7abc9b53bd ("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
This commit is contained in:
committed by
Madhavan Srinivasan
parent
65f5038352
commit
e834166822
@@ -215,7 +215,7 @@ static int mac_hid_toggle_emumouse(const struct ctl_table *table, int write,
|
||||
}
|
||||
|
||||
/* file(s) in /proc/sys/dev/mac_hid */
|
||||
static struct ctl_table mac_hid_files[] = {
|
||||
static const struct ctl_table mac_hid_files[] = {
|
||||
{
|
||||
.procname = "mouse_button_emulation",
|
||||
.data = &mouse_emulate_buttons,
|
||||
|
||||
Reference in New Issue
Block a user