drivers/mfd/88pm886.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
'struct regmap_irq_chip' is not modified in this driver.
Constifying this structure moves some data to a read-only section, so
increase overall security, especially when the structure holds some
function pointers.
While at it, also constify some other structures.
On a x86_64, with allmodconfig, as an example:
Before:
======
text data bss dec hex filename
5032 3304 64 8400 20d0 drivers/mfd/88pm886.o
After:
=====
text data bss dec hex filename
5800 2536 64 8400 20d0 drivers/mfd/88pm886.o
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Compile tested-only.
---
drivers/mfd/88pm886.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/mfd/88pm886.c b/drivers/mfd/88pm886.c
index 891fdce5d8c1..bbf9dd449d41 100644
--- a/drivers/mfd/88pm886.c
+++ b/drivers/mfd/88pm886.c
@@ -16,11 +16,11 @@ static const struct regmap_config pm886_regmap_config = {
.max_register = PM886_REG_RTC_SPARE6,
};
-static struct regmap_irq pm886_regmap_irqs[] = {
+static const struct regmap_irq pm886_regmap_irqs[] = {
REGMAP_IRQ_REG(PM886_IRQ_ONKEY, 0, PM886_INT_ENA1_ONKEY),
};
-static struct regmap_irq_chip pm886_regmap_irq_chip = {
+static const struct regmap_irq_chip pm886_regmap_irq_chip = {
.name = "88pm886",
.irqs = pm886_regmap_irqs,
.num_irqs = ARRAY_SIZE(pm886_regmap_irqs),
@@ -30,11 +30,11 @@ static struct regmap_irq_chip pm886_regmap_irq_chip = {
.unmask_base = PM886_REG_INT_ENA_1,
};
-static struct resource pm886_onkey_resources[] = {
+static const struct resource pm886_onkey_resources[] = {
DEFINE_RES_IRQ_NAMED(PM886_IRQ_ONKEY, "88pm886-onkey"),
};
-static struct mfd_cell pm886_devs[] = {
+static const struct mfd_cell pm886_devs[] = {
MFD_CELL_RES("88pm886-onkey", pm886_onkey_resources),
MFD_CELL_NAME("88pm886-regulator"),
MFD_CELL_NAME("88pm886-rtc"),
--
2.49.0
Christophe JAILLET, 2025-05-11T22:42:30+02:00: > 'struct regmap_irq_chip' is not modified in this driver. > > Constifying this structure moves some data to a read-only section, so > increase overall security, especially when the structure holds some increases > function pointers. > > While at it, also constify some other structures. > > On a x86_64, with allmodconfig, as an example: > Before: > ====== > text data bss dec hex filename > 5032 3304 64 8400 20d0 drivers/mfd/88pm886.o > > After: > ===== > text data bss dec hex filename > 5800 2536 64 8400 20d0 drivers/mfd/88pm886.o > > Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> > --- > Compile tested-only. > --- > drivers/mfd/88pm886.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) Reviewed-by: Karel Balej <balejk@matfyz.cz> Thanks, K. B.
On Sun, 11 May 2025 22:42:30 +0200, Christophe JAILLET wrote:
> 'struct regmap_irq_chip' is not modified in this driver.
>
> Constifying this structure moves some data to a read-only section, so
> increase overall security, especially when the structure holds some
> function pointers.
>
> While at it, also constify some other structures.
>
> [...]
Applied, thanks!
[1/1] mfd: 88pm886: Constify struct regmap_irq_chip and some other structures
commit: 960391e115f535f631d558784d70e8e33ad0a30e
--
Lee Jones [李琼斯]
© 2016 - 2025 Red Hat, Inc.