mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] nvmet: pci-epf: Constify struct pci_epf_ops
@ 2026-10-31 21:36 Christophe JAILLET
  2026-11-03  5:30 ` Christoph Hellwig
  2026-11-03 15:37 ` Keith Busch
  0 siblings, 2 replies; 3+ messages in thread
From: Christophe JAILLET @ 2026-10-31 21:36 UTC (permalink / raw)
  To: Christoph Hellwig, Sagi Grimberg, Chaitanya Kulkarni
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET, linux-nvme

'struct pci_epf_ops' is not modified in this driver.

Constifying this structure 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
  90026	  19680	    768	 110474	  1af8a	drivers/nvme/target/pci-epf.o

After:
=====
   text	   data	    bss	    dec	    hex	filename
  90090	  19616	    768	 110474	  1af8a	drivers/nvme/target/pci-epf.o

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Compile tested only.
---
 drivers/nvme/target/pci-epf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nvme/target/pci-epf.c b/drivers/nvme/target/pci-epf.c
index c683450df422..377cd428fa65 100644
--- a/drivers/nvme/target/pci-epf.c
+++ b/drivers/nvme/target/pci-epf.c
@@ -2587,7 +2587,7 @@ static const struct pci_epf_device_id nvmet_pci_epf_ids[] = {
 	{},
 };
 
-static struct pci_epf_ops nvmet_pci_epf_ops = {
+static const struct pci_epf_ops nvmet_pci_epf_ops = {
 	.bind	= nvmet_pci_epf_bind,
 	.unbind	= nvmet_pci_epf_unbind,
 	.add_cfs = nvmet_pci_epf_add_cfs,
-- 
2.56.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-03 15:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-31 21:36 [PATCH] nvmet: pci-epf: Constify struct pci_epf_ops Christophe JAILLET
2026-11-03  5:30 ` Christoph Hellwig
2026-11-03 15:37 ` Keith Busch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®