macintosh: declare ctl_table as const
authorLuis Felipe Hernandez <luis.hernandez093@gmail.com>
Wed, 18 Dec 2024 02:55:41 +0000 (21:55 -0500)
committerMadhavan Srinivasan <maddy@linux.ibm.com>
Wed, 18 Dec 2024 08:11:23 +0000 (13:41 +0530)
commite834166822a3c9fb403411c898367df8dabf973c
tree6f051fb4669f07570ddafafd221ebbb6b403a404
parent65f5038352e8f635fb827f7482f1d08fae4d16bf
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
drivers/macintosh/mac_hid.c