mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] peci: npcm: Constify struct peci_controller_ops​
@ 2024-09-07  7:00 Christophe JAILLET
  2024-09-09  8:39 ` Winiarska, Iwona
  0 siblings, 1 reply; 2+ messages in thread
From: Christophe JAILLET @ 2024-09-07  7:00 UTC (permalink / raw)
  To: Avi Fishman, Tomer Maimon, Tali Perry, Patrick Venture,
	Nancy Yuen, Benjamin Fair, Iwona Winiarska
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET, openbmc

'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>
---
Compile tested only
---
 drivers/peci/controller/peci-npcm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/peci/controller/peci-npcm.c b/drivers/peci/controller/peci-npcm.c
index ec613d35c796..fa91be58f6f3 100644
--- a/drivers/peci/controller/peci-npcm.c
+++ b/drivers/peci/controller/peci-npcm.c
@@ -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,
 };
 
-- 
2.46.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] peci: npcm: Constify struct peci_controller_ops​
  2024-09-07  7:00 [PATCH] peci: npcm: Constify struct peci_controller_ops​ Christophe JAILLET
@ 2024-09-09  8:39 ` Winiarska, Iwona
  0 siblings, 0 replies; 2+ messages in thread
From: Winiarska, Iwona @ 2024-09-09  8:39 UTC (permalink / raw)
  To: tmaimon77, tali.perry1, venture, avifishman70,
	christophe.jaillet, yuenn, Fair, Benjamin
  Cc: kernel-janitors, linux-kernel, openbmc

On Sat, 2024-09-07 at 09:00 +0200, Christophe JAILLET wrote:
> '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>

Thanks
-Iwona

> ---
> Compile tested only
> ---
>  drivers/peci/controller/peci-npcm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/peci/controller/peci-npcm.c
> b/drivers/peci/controller/peci-npcm.c
> index ec613d35c796..fa91be58f6f3 100644
> --- a/drivers/peci/controller/peci-npcm.c
> +++ b/drivers/peci/controller/peci-npcm.c
> @@ -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,
>  };
>  


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-09-09  8:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-09-07  7:00 [PATCH] peci: npcm: Constify struct peci_controller_ops​ Christophe JAILLET
2024-09-09  8:39 ` Winiarska, Iwona

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome