Skip to content

Commit 4d0b04d

Browse files
tititiou36kawasaki
authored andcommitted
null_blk: Constify struct configfs_item_operations and configfs_group_operations
'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 <[email protected]>
1 parent a2a6d78 commit 4d0b04d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/block/null_blk/main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,7 @@ static void nullb_device_release(struct config_item *item)
642642
null_free_dev(dev);
643643
}
644644

645-
static struct configfs_item_operations nullb_device_ops = {
645+
static const struct configfs_item_operations nullb_device_ops = {
646646
.release = nullb_device_release,
647647
};
648648

@@ -739,7 +739,7 @@ static struct configfs_attribute *nullb_group_attrs[] = {
739739
NULL,
740740
};
741741

742-
static struct configfs_group_operations nullb_group_ops = {
742+
static const struct configfs_group_operations nullb_group_ops = {
743743
.make_group = nullb_group_make_group,
744744
.drop_item = nullb_group_drop_item,
745745
};

0 commit comments

Comments
 (0)