PCI: ls-gen4: Constify struct mobiveil_rp_ops
Subsystems (5)
PATCH 1/1 PCI: ls-gen4: Constify struct mobiveil_rp_ops
'struct mobiveil_rp_ops' is not modified in this driver.
Constifying this structure moves some data to a read-only section, so increase overall security.
On a x86_64, with allmodconfig, as an example:
Before:
======
text data bss dec hex filename
4446 336 32 4814 12ce drivers/pci/controller/mobiveil/pcie-layerscape-gen4.o
After:
=====
text data bss dec hex filename
4454 328 32 4814 12ce drivers/pci/controller/mobiveil/pcie-layerscape-gen4.o
---
Compile tested-only
--- drivers/pci/controller/mobiveil/pcie-layerscape-gen4.c | 2 +- drivers/pci/controller/mobiveil/pcie-mobiveil.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/pci/controller/mobiveil/pcie-layerscape-gen4.c +1 -1
@@ -190,7 +190,7 @@ static void ls_g4_pcie_reset(struct work_struct *work)ls_g4_pcie_enable_interrupt (pcie); } -static struct mobiveil_rp_ops ls_g4_pcie_rp_ops = { +static const struct mobiveil_rp_ops ls_g4_pcie_rp_ops = { .interrupt_init = ls_g4_pcie_interrupt_init, };
drivers/pci/controller/mobiveil/pcie-mobiveil.h +1 -1
@@ -151,7 +151,7 @@ struct mobiveil_rp_ops {struct mobiveil_root_port {void __iomem *config_axi_slave_base;/* endpoint config base */ struct resource *ob_io_res; -struct mobiveil_rp_ops *ops; +const struct mobiveil_rp_ops *ops;int irq;raw_spinlock_t intx_mask_lock;struct irq_domain *intx_domain;
Signature · 1 line
2.45.2
Krzysztof Wilczyński
AppliedHello,
Quoted 4 lines
'struct
mobiveil_rp_ops' is not modified in this driver.Constifying this structure moves some data to a read-only section, so increase overall security.
Applied to controller/layerscape, thank you!
[1/1] PCI: ls-gen4: Make struct mobiveil_rp_ops constant
https://git.kernel.org/pci/pci/c/cd09a6ac85b9 Krzysztof