* [PATCH net-next] netconsole: Constify struct configfs_item_operations and configfs_group_operations
@ 2026-05-25 12:23 Christophe JAILLET
2026-05-25 16:18 ` Breno Leitao
0 siblings, 1 reply; 2+ messages in thread
From: Christophe JAILLET @ 2026-05-25 12:23 UTC (permalink / raw)
To: Breno Leitao, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni
Cc: linux-kernel, kernel-janitors, Christophe JAILLET, netdev
'struct configfs_item_operations' and 'configfs_group_operations' are not
modified in this driver.
Constifying these structures moves some data to a read-only section, so
increases overall security, especially when the structure holds some
function pointers.
On a x86_64, with allmodconfig, as an example:
Before:
======
text data bss dec hex filename
64259 24272 608 89139 15c33 drivers/net/netconsole.o
After:
=====
text data bss dec hex filename
64579 23952 608 89139 15c33 drivers/net/netconsole.o
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Compile tested only.
---
drivers/net/netconsole.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
index d804d44af87c..8ecc2c71c699 100644
--- a/drivers/net/netconsole.c
+++ b/drivers/net/netconsole.c
@@ -1264,7 +1264,7 @@ static void userdatum_release(struct config_item *item)
kfree(to_userdatum(item));
}
-static struct configfs_item_operations userdatum_ops = {
+static const struct configfs_item_operations userdatum_ops = {
.release = userdatum_release,
};
@@ -1319,7 +1319,7 @@ static struct configfs_attribute *userdata_attrs[] = {
NULL,
};
-static struct configfs_group_operations userdata_ops = {
+static const struct configfs_group_operations userdata_ops = {
.make_item = userdatum_make_item,
.drop_item = userdatum_drop,
};
@@ -1370,7 +1370,7 @@ static void netconsole_target_release(struct config_item *item)
kfree(nt);
}
-static struct configfs_item_operations netconsole_target_item_ops = {
+static const struct configfs_item_operations netconsole_target_item_ops = {
.release = netconsole_target_release,
};
@@ -1480,7 +1480,7 @@ static void drop_netconsole_target(struct config_group *group,
config_item_put(&nt->group.cg_item);
}
-static struct configfs_group_operations netconsole_subsys_group_ops = {
+static const struct configfs_group_operations netconsole_subsys_group_ops = {
.make_group = make_netconsole_target,
.drop_item = drop_netconsole_target,
};
--
2.54.0
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH net-next] netconsole: Constify struct configfs_item_operations and configfs_group_operations
2026-05-25 12:23 [PATCH net-next] netconsole: Constify struct configfs_item_operations and configfs_group_operations Christophe JAILLET
@ 2026-05-25 16:18 ` Breno Leitao
0 siblings, 0 replies; 2+ messages in thread
From: Breno Leitao @ 2026-05-25 16:18 UTC (permalink / raw)
To: Christophe JAILLET
Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, linux-kernel, kernel-janitors, netdev
On Mon, May 25, 2026 at 02:23:00PM +0000, Christophe JAILLET wrote:
> 'struct configfs_item_operations' and 'configfs_group_operations' are not
> modified in this driver.
>
> Constifying these structures moves some data to a read-only section, so
> increases overall security, especially when the structure holds some
> function pointers.
>
> On a x86_64, with allmodconfig, as an example:
> Before:
> ======
> text data bss dec hex filename
> 64259 24272 608 89139 15c33 drivers/net/netconsole.o
>
> After:
> =====
> text data bss dec hex filename
> 64579 23952 608 89139 15c33 drivers/net/netconsole.o
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Breno Leitao <leitao@debian.org>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-05-25 16:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-25 12:23 [PATCH net-next] netconsole: Constify struct configfs_item_operations and configfs_group_operations Christophe JAILLET
2026-05-25 16:18 ` Breno Leitao
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox