* [PATCH] PCI: ls-gen4: Constify struct mobiveil_rp_ops
@ 2024-06-24 20:18 Christophe JAILLET
2024-06-25 1:07 ` Krzysztof Wilczyński
0 siblings, 1 reply; 2+ messages in thread
From: Christophe JAILLET @ 2024-06-24 20:18 UTC (permalink / raw)
To: Hou Zhiqiang, Lorenzo Pieralisi, Krzysztof Wilczyński,
Rob Herring, Bjorn Helgaas, Karthikeyan Mitran
Cc: linux-kernel, kernel-janitors, Christophe JAILLET, linux-pci,
linux-arm-kernel
'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
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
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(-)
diff --git a/drivers/pci/controller/mobiveil/pcie-layerscape-gen4.c b/drivers/pci/controller/mobiveil/pcie-layerscape-gen4.c
index d7b7350f02dd..5af22bee913b 100644
--- a/drivers/pci/controller/mobiveil/pcie-layerscape-gen4.c
+++ b/drivers/pci/controller/mobiveil/pcie-layerscape-gen4.c
@@ -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,
};
diff --git a/drivers/pci/controller/mobiveil/pcie-mobiveil.h b/drivers/pci/controller/mobiveil/pcie-mobiveil.h
index 6082b8afbc31..e63abb887ee3 100644
--- a/drivers/pci/controller/mobiveil/pcie-mobiveil.h
+++ b/drivers/pci/controller/mobiveil/pcie-mobiveil.h
@@ -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;
--
2.45.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] PCI: ls-gen4: Constify struct mobiveil_rp_ops
2024-06-24 20:18 [PATCH] PCI: ls-gen4: Constify struct mobiveil_rp_ops Christophe JAILLET
@ 2024-06-25 1:07 ` Krzysztof Wilczyński
0 siblings, 0 replies; 2+ messages in thread
From: Krzysztof Wilczyński @ 2024-06-25 1:07 UTC (permalink / raw)
To: Christophe JAILLET
Cc: Hou Zhiqiang, Lorenzo Pieralisi, Rob Herring, Bjorn Helgaas,
Karthikeyan Mitran, linux-kernel, kernel-janitors, linux-pci,
linux-arm-kernel
Hello,
> '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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-06-25 1:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-24 20:18 [PATCH] PCI: ls-gen4: Constify struct mobiveil_rp_ops Christophe JAILLET
2024-06-25 1:07 ` Krzysztof Wilczyński
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox