[PATCH] most: Constify struct configfs_item_operations and configfs_group_operations

Christophe JAILLET posted 1 patch 1 month, 2 weeks ago
drivers/most/configfs.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
[PATCH] most: Constify struct configfs_item_operations and configfs_group_operations
Posted by Christophe JAILLET 1 month, 2 weeks ago
'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
  21305	  12664	    320	  34289	   85f1	drivers/most/configfs.o

After:
=====
   text	   data	    bss	    dec	    hex	filename
  21785	  12184	    320	  34289	   85f1	drivers/most/configfs.o

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Compile tested only.

This change is possible since commits f2f36500a63b and f7f78098690d.
---
 drivers/most/configfs.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/most/configfs.c b/drivers/most/configfs.c
index 36d8c917f65f..e9d7a25ced6d 100644
--- a/drivers/most/configfs.c
+++ b/drivers/most/configfs.c
@@ -399,7 +399,7 @@ static void mdev_link_release(struct config_item *item)
 	kfree(to_mdev_link(item));
 }
 
-static struct configfs_item_operations mdev_link_item_ops = {
+static const struct configfs_item_operations mdev_link_item_ops = {
 	.release		= mdev_link_release,
 };
 
@@ -454,7 +454,7 @@ static void most_common_release(struct config_item *item)
 	kfree(to_most_common(group->cg_subsys));
 }
 
-static struct configfs_item_operations most_common_item_ops = {
+static const struct configfs_item_operations most_common_item_ops = {
 	.release	= most_common_release,
 };
 
@@ -466,7 +466,7 @@ static void most_common_disconnect(struct config_group *group,
 	module_put(mc->mod);
 }
 
-static struct configfs_group_operations most_common_group_ops = {
+static const struct configfs_group_operations most_common_group_ops = {
 	.make_item	= most_common_make_item,
 	.disconnect_notify = most_common_disconnect,
 };
@@ -571,11 +571,11 @@ static void most_snd_grp_release(struct config_item *item)
 	kfree(group);
 }
 
-static struct configfs_item_operations most_snd_grp_item_ops = {
+static const struct configfs_item_operations most_snd_grp_item_ops = {
 	.release	= most_snd_grp_release,
 };
 
-static struct configfs_group_operations most_snd_grp_group_ops = {
+static const struct configfs_group_operations most_snd_grp_group_ops = {
 	.make_item	= most_snd_grp_make_item,
 };
 
@@ -625,7 +625,7 @@ static void most_sound_disconnect(struct config_group *group,
 	module_put(ms->mod);
 }
 
-static struct configfs_group_operations most_sound_group_ops = {
+static const struct configfs_group_operations most_sound_group_ops = {
 	.make_group	= most_sound_make_group,
 	.disconnect_notify = most_sound_disconnect,
 };
-- 
2.52.0