From: Luis Felipe Hernandez <luis.hernandez093@gmail.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Slaby <jirislaby@kernel.org>
Cc: "Thomas Weißschuh" <linux@weissschuh.net>,
linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org,
"Ricardo B. Marliere" <rbm@suse.com>,
"Luis Felipe Hernandez" <luis.hernandez093@gmail.com>
Subject: [PATCH] tty: mark ctl_table as const
Date: Sun, 15 Dec 2024 16:30:25 -0500 [thread overview]
Message-ID: <20241215-tty-sysctl-const-v1-1-96884e456126@gmail.com> (raw)
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.
tty_table is registered as a sysctl table and should be treated as
read-only. By declaring the tty_table structure as const, we ensure that it
cannot be accidentally modified at runtime. This change improves safety
and aligns with the recommendation from commit 7abc9b53bd51 ("sysctl: allow
registration of const struct ctl_table").
Cc: Thomas Weißschuh <linux@weissschuh.net>
Suggested-by: Thomas Weißschuh <linux@weissschuh.net>
Suggested-by: Ricardo B. Marliere <rbm@suse.com>
Signed-off-by: Luis Felipe Hernandez <luis.hernandez093@gmail.com>
---
drivers/tty/tty_io.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index dcb1769c3625cd0f7d1555260adfe6051139a305..0e84677712b4e1eb72f209c4d9c54a940b3a9041 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -3618,7 +3618,7 @@ void console_sysfs_notify(void)
sysfs_notify(&consdev->kobj, NULL, "active");
}
-static struct ctl_table tty_table[] = {
+static const struct ctl_table tty_table[] = {
{
.procname = "legacy_tiocsti",
.data = &tty_legacy_tiocsti,
---
base-commit: 535a07698b8b3e6f305673102d297262cae2360a
change-id: 20241206-tty-sysctl-const-2e4b37b1875b
Best regards,
--
Luis Felipe Hernandez <luis.hernandez093@gmail.com>
next reply other threads:[~2024-12-15 21:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-15 21:30 Luis Felipe Hernandez [this message]
2024-12-15 21:35 ` [PATCH] tty: mark ctl_table as const Luis Felipe Hernandez
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241215-tty-sysctl-const-v1-1-96884e456126@gmail.com \
--to=luis.hernandez093@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=jirislaby@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=linux@weissschuh.net \
--cc=rbm@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).