nvmet: pci-epf: Constify struct pci_epf_ops
Subsystems (3)
PATCH 1/1 nvmet: pci-epf: Constify struct pci_epf_ops
'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
---
Compile tested only.
--- drivers/nvme/target/pci-epf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/target/pci-epf.c +1 -1
@@ -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,
Signature · 1 line
2.56.0
Looks good:
Quoted 12 lines · Christophe JAILLET
'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 1af8adrivers/nvme/target/pci-epf.o
Quoted 4 lines
After:
=====
text data bss dec hex filename
90090 19616 768 110474 1af8adrivers/nvme/target/pci-epf.o
Thanks, applied to nvme-7.4.