* [PATCH] iio: core: Constify struct configfs_item_operations and configfs_group_operations
@ 2025-12-29 11:27 Christophe JAILLET
2025-12-31 17:20 ` Jonathan Cameron
0 siblings, 1 reply; 2+ messages in thread
From: Christophe JAILLET @ 2025-12-29 11:27 UTC (permalink / raw)
To: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko
Cc: linux-kernel, kernel-janitors, Christophe JAILLET, linux-iio
'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:
Before:
======
text data bss dec hex filename
5037 1528 64 6629 19e5 drivers/iio/industrialio-sw-device.o
5509 1528 64 7101 1bbd drivers/iio/industrialio-sw-trigger.o
After:
=====
text data bss dec hex filename
5133 1432 64 6629 19e5 drivers/iio/industrialio-sw-device.o
5605 1432 64 7101 1bbd drivers/iio/industrialio-sw-trigger.o
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Compile tested only.
This change is possible since commits f2f36500a63b and f7f78098690d.
---
drivers/iio/industrialio-sw-device.c | 2 +-
drivers/iio/industrialio-sw-trigger.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/iio/industrialio-sw-device.c b/drivers/iio/industrialio-sw-device.c
index cdaf30a3f233..3582524de0b8 100644
--- a/drivers/iio/industrialio-sw-device.c
+++ b/drivers/iio/industrialio-sw-device.c
@@ -148,7 +148,7 @@ static void device_drop_group(struct config_group *group,
config_item_put(item);
}
-static struct configfs_group_operations device_ops = {
+static const struct configfs_group_operations device_ops = {
.make_group = &device_make_group,
.drop_item = &device_drop_group,
};
diff --git a/drivers/iio/industrialio-sw-trigger.c b/drivers/iio/industrialio-sw-trigger.c
index d86a3305d9e8..334b6b10a784 100644
--- a/drivers/iio/industrialio-sw-trigger.c
+++ b/drivers/iio/industrialio-sw-trigger.c
@@ -152,7 +152,7 @@ static void trigger_drop_group(struct config_group *group,
config_item_put(item);
}
-static struct configfs_group_operations trigger_ops = {
+static const struct configfs_group_operations trigger_ops = {
.make_group = &trigger_make_group,
.drop_item = &trigger_drop_group,
};
--
2.52.0
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] iio: core: Constify struct configfs_item_operations and configfs_group_operations
2025-12-29 11:27 [PATCH] iio: core: Constify struct configfs_item_operations and configfs_group_operations Christophe JAILLET
@ 2025-12-31 17:20 ` Jonathan Cameron
0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Cameron @ 2025-12-31 17:20 UTC (permalink / raw)
To: Christophe JAILLET
Cc: David Lechner, Nuno Sá, Andy Shevchenko, linux-kernel,
kernel-janitors, linux-iio
On Mon, 29 Dec 2025 12:27:43 +0100
Christophe JAILLET <christophe.jaillet@wanadoo.fr> 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:
> Before:
> ======
> text data bss dec hex filename
> 5037 1528 64 6629 19e5 drivers/iio/industrialio-sw-device.o
> 5509 1528 64 7101 1bbd drivers/iio/industrialio-sw-trigger.o
>
> After:
> =====
> text data bss dec hex filename
> 5133 1432 64 6629 19e5 drivers/iio/industrialio-sw-device.o
> 5605 1432 64 7101 1bbd drivers/iio/industrialio-sw-trigger.o
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Applied to the togreg branch of iio.git which I'll push out initially as testing
for 0-day to take a look at it.
Thanks,
Jonathan
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-12-31 17:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-29 11:27 [PATCH] iio: core: Constify struct configfs_item_operations and configfs_group_operations Christophe JAILLET
2025-12-31 17:20 ` Jonathan Cameron
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox