lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <b87a0f4c7504d2b742b72ba86f95189b26da9484.1766495730.git.christophe.jaillet@wanadoo.fr>
Date: Tue, 23 Dec 2025 14:15:44 +0100
From: Christophe JAILLET <christophe.jaillet@...adoo.fr>
To: Parthiban Veerasooran <parthiban.veerasooran@...rochip.com>,
	Christian Gromm <christian.gromm@...rochip.com>
Cc: linux-kernel@...r.kernel.org,
	kernel-janitors@...r.kernel.org,
	Christophe JAILLET <christophe.jaillet@...adoo.fr>
Subject: [PATCH] most: 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
  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@...adoo.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


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ