peci: npcm: Constify struct peci_controller_ops​
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Sat, 7 Sep 2024 07:00:04 +0000 (09:00 +0200)
committerIwona Winiarska <iwona.winiarska@intel.com>
Fri, 25 Oct 2024 08:58:07 +0000 (10:58 +0200)
'struct peci_controller_ops' 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.

On a x86_64, with allmodconfig:
Before:
======
   text    data     bss     dec     hex filename
   8003     784      48    8835    2283 drivers/peci/controller/peci-npcm.o

After:
=====
   text    data     bss     dec     hex filename
   8003     776      48    8827    227b drivers/peci/controller/peci-npcm.o

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Iwona Winiarska <iwona.winiarska@intel.com>
Link: https://lore.kernel.org/r/3c7d455745c2265c19ed02f026dfc9610271d3c2.1725692376.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Iwona Winiarska <iwona.winiarska@intel.com>
drivers/peci/controller/peci-npcm.c

index ec613d3..fa91be5 100644 (file)
@@ -224,7 +224,7 @@ static const struct regmap_config npcm_peci_regmap_config = {
        .fast_io = true,
 };
 
-static struct peci_controller_ops npcm_ops = {
+static const struct peci_controller_ops npcm_ops = {
        .xfer = npcm_peci_xfer,
 };