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>] [thread-next>] [day] [month] [year] [list]
Message-ID: <82fd284cf70cffd374f5889a5c2a1f3800bafab3.1766495484.git.christophe.jaillet@wanadoo.fr>
Date: Tue, 23 Dec 2025 14:11:34 +0100
From: Christophe JAILLET <christophe.jaillet@...adoo.fr>
To: Christoph Hellwig <hch@....de>,
	Sagi Grimberg <sagi@...mberg.me>,
	Chaitanya Kulkarni <kch@...dia.com>
Cc: linux-kernel@...r.kernel.org,
	kernel-janitors@...r.kernel.org,
	Christophe JAILLET <christophe.jaillet@...adoo.fr>,
	linux-nvme@...ts.infradead.org
Subject: [PATCH] nvmet: 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
  79551	  38896	    640	 119087	  1d12f	drivers/nvme/target/configfs.o

After:
=====
   text	   data	    bss	    dec	    hex	filename
  80639	  37808	    640	 119087	  1d12f	drivers/nvme/target/configfs.o

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

This change is possible since commits f2f36500a63b and f7f78098690d.
---
 drivers/nvme/target/configfs.c | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/nvme/target/configfs.c b/drivers/nvme/target/configfs.c
index 825134d70d08..e44ef69dffc2 100644
--- a/drivers/nvme/target/configfs.c
+++ b/drivers/nvme/target/configfs.c
@@ -819,7 +819,7 @@ static void nvmet_ns_release(struct config_item *item)
 	nvmet_ns_free(ns);
 }
 
-static const struct configfs_item_operations nvmet_ns_item_ops = {
+static struct configfs_item_operations nvmet_ns_item_ops = {
 	.release		= nvmet_ns_release,
 };
 
@@ -860,7 +860,7 @@ static struct config_group *nvmet_ns_make(struct config_group *group,
 	return ERR_PTR(ret);
 }
 
-static const struct configfs_group_operations nvmet_namespaces_group_ops = {
+static struct configfs_group_operations nvmet_namespaces_group_ops = {
 	.make_group		= nvmet_ns_make,
 };
 
@@ -1095,7 +1095,7 @@ static void nvmet_port_subsys_drop_link(struct config_item *parent,
 	kfree(p);
 }
 
-static const struct configfs_item_operations nvmet_port_subsys_item_ops = {
+static struct configfs_item_operations nvmet_port_subsys_item_ops = {
 	.allow_link		= nvmet_port_subsys_allow_link,
 	.drop_link		= nvmet_port_subsys_drop_link,
 };
@@ -1170,7 +1170,7 @@ static void nvmet_allowed_hosts_drop_link(struct config_item *parent,
 	kfree(p);
 }
 
-static const struct configfs_item_operations nvmet_allowed_hosts_item_ops = {
+static struct configfs_item_operations nvmet_allowed_hosts_item_ops = {
 	.allow_link		= nvmet_allowed_hosts_allow_link,
 	.drop_link		= nvmet_allowed_hosts_drop_link,
 };
@@ -1696,7 +1696,7 @@ static void nvmet_subsys_release(struct config_item *item)
 	nvmet_subsys_put(subsys);
 }
 
-static const struct configfs_item_operations nvmet_subsys_item_ops = {
+static struct configfs_item_operations nvmet_subsys_item_ops = {
 	.release		= nvmet_subsys_release,
 };
 
@@ -1741,7 +1741,7 @@ static struct config_group *nvmet_subsys_make(struct config_group *group,
 	return &subsys->group;
 }
 
-static const struct configfs_group_operations nvmet_subsystems_group_ops = {
+static struct configfs_group_operations nvmet_subsystems_group_ops = {
 	.make_group		= nvmet_subsys_make,
 };
 
@@ -1809,7 +1809,7 @@ static void nvmet_referral_release(struct config_item *item)
 	kfree(port);
 }
 
-static const struct configfs_item_operations nvmet_referral_item_ops = {
+static struct configfs_item_operations nvmet_referral_item_ops = {
 	.release	= nvmet_referral_release,
 };
 
@@ -1835,7 +1835,7 @@ static struct config_group *nvmet_referral_make(
 	return &port->group;
 }
 
-static const struct configfs_group_operations nvmet_referral_group_ops = {
+static struct configfs_group_operations nvmet_referral_group_ops = {
 	.make_group		= nvmet_referral_make,
 	.disconnect_notify	= nvmet_referral_notify,
 };
@@ -1915,7 +1915,7 @@ static void nvmet_ana_group_release(struct config_item *item)
 	kfree(grp);
 }
 
-static const struct configfs_item_operations nvmet_ana_group_item_ops = {
+static struct configfs_item_operations nvmet_ana_group_item_ops = {
 	.release		= nvmet_ana_group_release,
 };
 
@@ -1961,7 +1961,7 @@ static struct config_group *nvmet_ana_groups_make_group(
 	return ERR_PTR(ret);
 }
 
-static const struct configfs_group_operations nvmet_ana_groups_group_ops = {
+static struct configfs_group_operations nvmet_ana_groups_group_ops = {
 	.make_group		= nvmet_ana_groups_make_group,
 };
 
@@ -2001,7 +2001,7 @@ static struct configfs_attribute *nvmet_port_attrs[] = {
 	NULL,
 };
 
-static const struct configfs_item_operations nvmet_port_item_ops = {
+static struct configfs_item_operations nvmet_port_item_ops = {
 	.release		= nvmet_port_release,
 };
 
@@ -2084,7 +2084,7 @@ static struct config_group *nvmet_ports_make(struct config_group *group,
 	return &port->group;
 }
 
-static const struct configfs_group_operations nvmet_ports_group_ops = {
+static struct configfs_group_operations nvmet_ports_group_ops = {
 	.make_group		= nvmet_ports_make,
 };
 
@@ -2239,7 +2239,7 @@ static void nvmet_host_release(struct config_item *item)
 	kfree(host);
 }
 
-static const struct configfs_item_operations nvmet_host_item_ops = {
+static struct configfs_item_operations nvmet_host_item_ops = {
 	.release		= nvmet_host_release,
 };
 
@@ -2270,7 +2270,7 @@ static struct config_group *nvmet_hosts_make_group(struct config_group *group,
 	return &host->group;
 }
 
-static const struct configfs_group_operations nvmet_hosts_group_ops = {
+static struct configfs_group_operations nvmet_hosts_group_ops = {
 	.make_group		= nvmet_hosts_make_group,
 };
 
-- 
2.52.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ