From nobody Mon Feb 9 01:42:16 2026 Received: from smtp.smtpout.orange.fr (smtp-80.smtpout.orange.fr [80.12.242.80]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 98CD87FBAC; Tue, 23 Dec 2025 13:11:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=80.12.242.80 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766495516; cv=none; b=Fg3oPwhJ11cpmmUV2D+pLw+YbLDgsaSabCNV7eijDcSQwgaOPeJSAk2ydZ8kog3tj4/J+KqPegizBLfNGg+mIQNE7z9KuxzxKyjK25exhfn0qtE1KVXyjTyo1lsYUPCv3w7gXTtKtiOmT21XSj34vZ4isj+i9GpIGF8KfxL6apo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766495516; c=relaxed/simple; bh=F3I4K5OPzhqrJhb1R+suDOXU3Bz/yMpyvzTo7HfG0LM=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=SKCWTSyAgWtL4Htq1u0pSuy9sl33TFg6Ap1O9OA/V1dEwLFnFzWcxLWVUQgZ24pbo5OyC+1rb+n8F8dtlhuioYO0rM6NAVG9KWY6NyW3KrPi1pPDbvSW6uRn+pfR+DdsnRoYywVf04607wu1mdAxqW3DYY+nLqEzGPGvOuxxqEo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wanadoo.fr; spf=pass smtp.mailfrom=wanadoo.fr; dkim=pass (2048-bit key) header.d=wanadoo.fr header.i=@wanadoo.fr header.b=Wq4TJWOU; arc=none smtp.client-ip=80.12.242.80 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wanadoo.fr Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wanadoo.fr Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wanadoo.fr header.i=@wanadoo.fr header.b="Wq4TJWOU" Received: from fedora.home ([IPv6:2a01:cb10:785:b00:8347:f260:7456:7662]) by smtp.orange.fr with ESMTPA id Y2Auvr9AoECGYY2AuvgbFO; Tue, 23 Dec 2025 14:11:42 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1766495502; bh=bM58L9I/i9ZyMehfLP2aRrDC5Uf7gxt7KWKdUsPNwLk=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=Wq4TJWOUAv3HjtdEoq0EKiQM+v6W6hg2BgCcvxAwz6+//i2k5ybAp8fSh0qln+EPp 91VJPSMgW5KmO/cEC0PHo2oFYno9CvZsHz5baqX4ddZKuSars1FwM48T21mqWV6x22 OaxnR+x31R32HNuoEzEn52Qvhk8ISNj3MFPotiZ53SVG9jb1cLc1Vi6mi3ZssCK0zg ZcW2b3siiHwR5dgC0jewAe8QJgBPP1l174+BExhEYCCVYGeVUVaMp1bWn3GNxGr6nV 0KCyApGp2NPdlHtePeigUQ947MJsRrinxs6XdM4h6pcGQWKt9Jvv0lDd5jlKOzZQyk zE+FU85YWbAcQ== X-ME-Helo: fedora.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Tue, 23 Dec 2025 14:11:42 +0100 X-ME-IP: 2a01:cb10:785:b00:8347:f260:7456:7662 From: Christophe JAILLET To: Christoph Hellwig , Sagi Grimberg , Chaitanya Kulkarni Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , linux-nvme@lists.infradead.org Subject: [PATCH] nvmet: Constify struct configfs_item_operations and configfs_group_operations Date: Tue, 23 Dec 2025 14:11:34 +0100 Message-ID: <82fd284cf70cffd374f5889a5c2a1f3800bafab3.1766495484.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.52.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" '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: =3D=3D=3D=3D=3D=3D text data bss dec hex filename 79551 38896 640 119087 1d12f drivers/nvme/target/configfs.o After: =3D=3D=3D=3D=3D text data bss dec hex filename 80639 37808 640 119087 1d12f drivers/nvme/target/configfs.o Signed-off-by: Christophe JAILLET Reviewed-by: Christoph Hellwig Reviewed-by: Sagi Grimberg --- 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); } =20 -static const struct configfs_item_operations nvmet_ns_item_ops =3D { +static struct configfs_item_operations nvmet_ns_item_ops =3D { .release =3D nvmet_ns_release, }; =20 @@ -860,7 +860,7 @@ static struct config_group *nvmet_ns_make(struct config= _group *group, return ERR_PTR(ret); } =20 -static const struct configfs_group_operations nvmet_namespaces_group_ops = =3D { +static struct configfs_group_operations nvmet_namespaces_group_ops =3D { .make_group =3D nvmet_ns_make, }; =20 @@ -1095,7 +1095,7 @@ static void nvmet_port_subsys_drop_link(struct config= _item *parent, kfree(p); } =20 -static const struct configfs_item_operations nvmet_port_subsys_item_ops = =3D { +static struct configfs_item_operations nvmet_port_subsys_item_ops =3D { .allow_link =3D nvmet_port_subsys_allow_link, .drop_link =3D nvmet_port_subsys_drop_link, }; @@ -1170,7 +1170,7 @@ static void nvmet_allowed_hosts_drop_link(struct conf= ig_item *parent, kfree(p); } =20 -static const struct configfs_item_operations nvmet_allowed_hosts_item_ops = =3D { +static struct configfs_item_operations nvmet_allowed_hosts_item_ops =3D { .allow_link =3D nvmet_allowed_hosts_allow_link, .drop_link =3D nvmet_allowed_hosts_drop_link, }; @@ -1696,7 +1696,7 @@ static void nvmet_subsys_release(struct config_item *= item) nvmet_subsys_put(subsys); } =20 -static const struct configfs_item_operations nvmet_subsys_item_ops =3D { +static struct configfs_item_operations nvmet_subsys_item_ops =3D { .release =3D nvmet_subsys_release, }; =20 @@ -1741,7 +1741,7 @@ static struct config_group *nvmet_subsys_make(struct = config_group *group, return &subsys->group; } =20 -static const struct configfs_group_operations nvmet_subsystems_group_ops = =3D { +static struct configfs_group_operations nvmet_subsystems_group_ops =3D { .make_group =3D nvmet_subsys_make, }; =20 @@ -1809,7 +1809,7 @@ static void nvmet_referral_release(struct config_item= *item) kfree(port); } =20 -static const struct configfs_item_operations nvmet_referral_item_ops =3D { +static struct configfs_item_operations nvmet_referral_item_ops =3D { .release =3D nvmet_referral_release, }; =20 @@ -1835,7 +1835,7 @@ static struct config_group *nvmet_referral_make( return &port->group; } =20 -static const struct configfs_group_operations nvmet_referral_group_ops =3D= { +static struct configfs_group_operations nvmet_referral_group_ops =3D { .make_group =3D nvmet_referral_make, .disconnect_notify =3D nvmet_referral_notify, }; @@ -1915,7 +1915,7 @@ static void nvmet_ana_group_release(struct config_ite= m *item) kfree(grp); } =20 -static const struct configfs_item_operations nvmet_ana_group_item_ops =3D { +static struct configfs_item_operations nvmet_ana_group_item_ops =3D { .release =3D nvmet_ana_group_release, }; =20 @@ -1961,7 +1961,7 @@ static struct config_group *nvmet_ana_groups_make_gro= up( return ERR_PTR(ret); } =20 -static const struct configfs_group_operations nvmet_ana_groups_group_ops = =3D { +static struct configfs_group_operations nvmet_ana_groups_group_ops =3D { .make_group =3D nvmet_ana_groups_make_group, }; =20 @@ -2001,7 +2001,7 @@ static struct configfs_attribute *nvmet_port_attrs[] = =3D { NULL, }; =20 -static const struct configfs_item_operations nvmet_port_item_ops =3D { +static struct configfs_item_operations nvmet_port_item_ops =3D { .release =3D nvmet_port_release, }; =20 @@ -2084,7 +2084,7 @@ static struct config_group *nvmet_ports_make(struct c= onfig_group *group, return &port->group; } =20 -static const struct configfs_group_operations nvmet_ports_group_ops =3D { +static struct configfs_group_operations nvmet_ports_group_ops =3D { .make_group =3D nvmet_ports_make, }; =20 @@ -2239,7 +2239,7 @@ static void nvmet_host_release(struct config_item *it= em) kfree(host); } =20 -static const struct configfs_item_operations nvmet_host_item_ops =3D { +static struct configfs_item_operations nvmet_host_item_ops =3D { .release =3D nvmet_host_release, }; =20 @@ -2270,7 +2270,7 @@ static struct config_group *nvmet_hosts_make_group(st= ruct config_group *group, return &host->group; } =20 -static const struct configfs_group_operations nvmet_hosts_group_ops =3D { +static struct configfs_group_operations nvmet_hosts_group_ops =3D { .make_group =3D nvmet_hosts_make_group, }; =20 --=20 2.52.0