* [PATCH] null_blk: Constify struct configfs_item_operations and configfs_group_operations
@ 2025-12-29 10:26 Christophe JAILLET
2025-12-29 15:19 ` Jens Axboe
0 siblings, 1 reply; 2+ messages in thread
From: Christophe JAILLET @ 2025-12-29 10:26 UTC (permalink / raw)
To: Jens Axboe; +Cc: linux-kernel, kernel-janitors, Christophe JAILLET, linux-block
'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
100263 37808 2752 140823 22617 drivers/block/null_blk/main.o
After:
=====
text data bss dec hex filename
100423 37648 2752 140823 22617 drivers/block/null_blk/main.o
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Compile tested only.
This change is possible since commits f2f36500a63b and f7f78098690d.
---
drivers/block/null_blk/main.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c
index c7c0fb79a6bf..29a371f48b57 100644
--- a/drivers/block/null_blk/main.c
+++ b/drivers/block/null_blk/main.c
@@ -642,7 +642,7 @@ static void nullb_device_release(struct config_item *item)
null_free_dev(dev);
}
-static struct configfs_item_operations nullb_device_ops = {
+static const struct configfs_item_operations nullb_device_ops = {
.release = nullb_device_release,
};
@@ -739,7 +739,7 @@ static struct configfs_attribute *nullb_group_attrs[] = {
NULL,
};
-static struct configfs_group_operations nullb_group_ops = {
+static const struct configfs_group_operations nullb_group_ops = {
.make_group = nullb_group_make_group,
.drop_item = nullb_group_drop_item,
};
--
2.52.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] null_blk: Constify struct configfs_item_operations and configfs_group_operations
2025-12-29 10:26 [PATCH] null_blk: Constify struct configfs_item_operations and configfs_group_operations Christophe JAILLET
@ 2025-12-29 15:19 ` Jens Axboe
0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2025-12-29 15:19 UTC (permalink / raw)
To: Christophe JAILLET; +Cc: linux-kernel, kernel-janitors, linux-block
On Mon, 29 Dec 2025 11:26:07 +0100, 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.
>
> [...]
Applied, thanks!
[1/1] null_blk: Constify struct configfs_item_operations and configfs_group_operations
commit: 9e371032cbf0c8fdc757df5510b55e824668b938
Best regards,
--
Jens Axboe
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-12-29 15:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-29 10:26 [PATCH] null_blk: Constify struct configfs_item_operations and configfs_group_operations Christophe JAILLET
2025-12-29 15:19 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®