From: Alexander Gordeev <[email protected]>
To: Joel Granados <[email protected]>
Cc: "Thomas Weißschuh" <[email protected]>,
"Kees Cook" <[email protected]>,
"Luis Chamberlain" <[email protected]>,
[email protected],
[email protected], [email protected],
[email protected], [email protected],
[email protected],
[email protected],
[email protected], [email protected],
[email protected], [email protected],
[email protected], [email protected],
[email protected], [email protected],
[email protected], [email protected],
[email protected], [email protected],
[email protected], [email protected],
[email protected], [email protected],
[email protected], [email protected],
[email protected], [email protected],
[email protected], [email protected],
[email protected], [email protected],
[email protected], [email protected],
"Song Liu" <[email protected]>,
"Steven Rostedt (Google)" <[email protected]>,
"Martin K. Petersen" <[email protected]>,
"Darrick J. Wong" <[email protected]>,
"Jani Nikula" <[email protected]>,
"Corey Minyard" <[email protected]>
Subject: Re: [PATCH v2] treewide: const qualify ctl_tables where applicable
Date: Tue, 21 Jan 2025 14:40:16 +0100 [thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
On Fri, Jan 10, 2025 at 03:16:08PM +0100, Joel Granados wrote:
Hi Joel,
> Add the const qualifier to all the ctl_tables in the tree except for
> watchdog_hardlockup_sysctl, memory_allocation_profiling_sysctls,
> loadpin_sysctl_table and the ones calling register_net_sysctl (./net,
> drivers/inifiniband dirs). These are special cases as they use a
> registration function with a non-const qualified ctl_table argument or
> modify the arrays before passing them on to the registration function.
>
> Constifying ctl_table structs will prevent the modification of
> proc_handler function pointers as the arrays would reside in .rodata.
> This is made possible after commit 78eb4ea25cd5 ("sysctl: treewide:
> constify the ctl_table argument of proc_handlers") constified all the
> proc_handlers.
I could identify at least these occurences in s390 code as well:
diff --git a/arch/s390/appldata/appldata_base.c b/arch/s390/appldata/appldata_base.c
index dd7ba7587dd5..9b83c318f919 100644
--- a/arch/s390/appldata/appldata_base.c
+++ b/arch/s390/appldata/appldata_base.c
@@ -204,7 +204,7 @@ appldata_timer_handler(const struct ctl_table *ctl, int write,
{
int timer_active = appldata_timer_active;
int rc;
- struct ctl_table ctl_entry = {
+ const struct ctl_table ctl_entry = {
.procname = ctl->procname,
.data = &timer_active,
.maxlen = sizeof(int),
@@ -237,7 +237,7 @@ appldata_interval_handler(const struct ctl_table *ctl, int write,
{
int interval = appldata_interval;
int rc;
- struct ctl_table ctl_entry = {
+ const struct ctl_table ctl_entry = {
.procname = ctl->procname,
.data = &interval,
.maxlen = sizeof(int),
@@ -269,7 +269,7 @@ appldata_generic_handler(const struct ctl_table *ctl, int write,
struct list_head *lh;
int rc, found;
int active;
- struct ctl_table ctl_entry = {
+ const struct ctl_table ctl_entry = {
.data = &active,
.maxlen = sizeof(int),
.extra1 = SYSCTL_ZERO,
diff --git a/arch/s390/kernel/hiperdispatch.c b/arch/s390/kernel/hiperdispatch.c
index 7857a7e8e56c..7d0ba16085c1 100644
--- a/arch/s390/kernel/hiperdispatch.c
+++ b/arch/s390/kernel/hiperdispatch.c
@@ -273,7 +273,7 @@ static int hiperdispatch_ctl_handler(const struct ctl_table *ctl, int write,
{
int hiperdispatch;
int rc;
- struct ctl_table ctl_entry = {
+ const struct ctl_table ctl_entry = {
.procname = ctl->procname,
.data = &hiperdispatch,
.maxlen = sizeof(int),
diff --git a/arch/s390/kernel/topology.c b/arch/s390/kernel/topology.c
index 6691808bf50a..26e50de83d80 100644
--- a/arch/s390/kernel/topology.c
+++ b/arch/s390/kernel/topology.c
@@ -629,7 +629,7 @@ static int topology_ctl_handler(const struct ctl_table *ctl, int write,
int enabled = topology_is_enabled();
int new_mode;
int rc;
- struct ctl_table ctl_entry = {
+ const struct ctl_table ctl_entry = {
.procname = ctl->procname,
.data = &enabled,
.maxlen = sizeof(int),
@@ -658,7 +658,7 @@ static int polarization_ctl_handler(const struct ctl_table *ctl, int write,
{
int polarization;
int rc;
- struct ctl_table ctl_entry = {
+ const struct ctl_table ctl_entry = {
.procname = ctl->procname,
.data = &polarization,
.maxlen = sizeof(int),
diff --git a/arch/s390/mm/cmm.c b/arch/s390/mm/cmm.c
index 939e3bec2db7..8e354c90a3dd 100644
--- a/arch/s390/mm/cmm.c
+++ b/arch/s390/mm/cmm.c
@@ -263,7 +263,7 @@ static int cmm_pages_handler(const struct ctl_table *ctl, int write,
void *buffer, size_t *lenp, loff_t *ppos)
{
long nr = cmm_get_pages();
- struct ctl_table ctl_entry = {
+ const struct ctl_table ctl_entry = {
.procname = ctl->procname,
.data = &nr,
.maxlen = sizeof(long),
@@ -283,7 +283,7 @@ static int cmm_timed_pages_handler(const struct ctl_table *ctl, int write,
loff_t *ppos)
{
long nr = cmm_get_timed_pages();
- struct ctl_table ctl_entry = {
+ const struct ctl_table ctl_entry = {
.procname = ctl->procname,
.data = &nr,
.maxlen = sizeof(long),
> Best regards,
> --
> Joel Granados <[email protected]>
Thanks!
next prev parent reply other threads:[~2025-01-21 13:40 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-10 14:16 [PATCH v2] treewide: const qualify ctl_tables where applicable Joel Granados
2025-01-10 18:28 ` Anna Schumaker
2025-01-12 10:36 ` Baoquan He
2025-01-15 17:52 ` Thomas Gleixner
2025-01-15 20:09 ` Wei Liu
2025-01-15 20:30 ` Bill O'Donnell
2025-01-21 13:40 ` Alexander Gordeev [this message]
2025-01-22 12:25 ` Joel Granados
2025-01-22 12:41 ` Ard Biesheuvel
2025-01-27 13:49 ` Joel Granados
2025-01-27 14:55 ` Jani Nikula
2025-01-27 15:42 ` Matthew Wilcox
2025-01-28 11:22 ` Joel Granados
2025-01-28 15:43 ` Paul Moore
2025-01-29 8:49 ` Joel Granados
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=Z4+jwDBrZNRgu85S@li-008a6a4c-3549-11b2-a85c-c5cc2836eea2.ibm.com \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
/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