From e834166822a3c9fb403411c898367df8dabf973c Mon Sep 17 00:00:00 2001 From: Luis Felipe Hernandez Date: Tue, 17 Dec 2024 21:55:41 -0500 Subject: [PATCH] macintosh: declare ctl_table as const MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 Suggested-by: Ricardo B. Marliere Reviewed-by: Ricardo B. Marliere Signed-off-by: Luis Felipe Hernandez Signed-off-by: Madhavan Srinivasan Link: https://patch.msgid.link/20241217-constify_ctl_table-v1-1-402ebceaeb8e@gmail.com --- drivers/macintosh/mac_hid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/macintosh/mac_hid.c b/drivers/macintosh/mac_hid.c index b461b1bed25b2..369d72f59b3c1 100644 --- a/drivers/macintosh/mac_hid.c +++ b/drivers/macintosh/mac_hid.c @@ -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, -- 2.47.2