linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] firmware: arm_scmi: Constify struct scmi_voltage_proto_ops
@ 2025-07-29 19:15 Christophe JAILLET
  2025-07-29 19:15 ` [PATCH 2/2] firmware: arm_scmi: Constify struct scmi_transport_ops Christophe JAILLET
  2025-08-26 10:37 ` [PATCH 1/2] firmware: arm_scmi: Constify struct scmi_voltage_proto_ops Sudeep Holla
  0 siblings, 2 replies; 3+ messages in thread
From: Christophe JAILLET @ 2025-07-29 19:15 UTC (permalink / raw)
  To: Sudeep Holla, Cristian Marussi
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET, arm-scmi,
	linux-arm-kernel

'struct scmi_voltage_proto_ops' is not modified in this driver.

Constifying this structure moves some data to a read-only section, so
increases overall security, especially when the structure holds some
function pointers.

On a x86_64, with allmodconfig, as an example:
Before:
======
   text	   data	    bss	    dec	    hex	filename
  13142	   1808	      0	  14950	   3a66	drivers/firmware/arm_scmi/voltage.o

After:
=====
   text	   data	    bss	    dec	    hex	filename
  13238	   1712	      0	  14950	   3a66	drivers/firmware/arm_scmi/voltage.o

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Compile tested only
---
 drivers/firmware/arm_scmi/voltage.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/firmware/arm_scmi/voltage.c b/drivers/firmware/arm_scmi/voltage.c
index fda6a1573609..17127880e10a 100644
--- a/drivers/firmware/arm_scmi/voltage.c
+++ b/drivers/firmware/arm_scmi/voltage.c
@@ -393,7 +393,7 @@ static int scmi_voltage_domains_num_get(const struct scmi_protocol_handle *ph)
 	return vinfo->num_domains;
 }
 
-static struct scmi_voltage_proto_ops voltage_proto_ops = {
+static const struct scmi_voltage_proto_ops voltage_proto_ops = {
 	.num_domains_get = scmi_voltage_domains_num_get,
 	.info_get = scmi_voltage_info_get,
 	.config_set = scmi_voltage_config_set,
-- 
2.50.1


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

* [PATCH 2/2] firmware: arm_scmi: Constify struct scmi_transport_ops
  2025-07-29 19:15 [PATCH 1/2] firmware: arm_scmi: Constify struct scmi_voltage_proto_ops Christophe JAILLET
@ 2025-07-29 19:15 ` Christophe JAILLET
  2025-08-26 10:37 ` [PATCH 1/2] firmware: arm_scmi: Constify struct scmi_voltage_proto_ops Sudeep Holla
  1 sibling, 0 replies; 3+ messages in thread
From: Christophe JAILLET @ 2025-07-29 19:15 UTC (permalink / raw)
  To: Sudeep Holla, Cristian Marussi
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET, arm-scmi,
	linux-arm-kernel

'struct scmi_transport_ops' is not modified in this driver.

Constifying this structure moves some data to a read-only section, so
increases overall security, especially when the structure holds some
function pointers.

On a x86_64, with allmodconfig, as an example:
Before:
======
   text	   data	    bss	    dec	    hex	filename
   6907	    680	     48	   7635	   1dd3	drivers/firmware/arm_scmi/transports/optee.o

After:
=====
   text	   data	    bss	    dec	    hex	filename
   6987	    576	     48	   7611	   1dbb	drivers/firmware/arm_scmi/transports/optee.o

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Compile tested only
---
 drivers/firmware/arm_scmi/transports/optee.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/firmware/arm_scmi/transports/optee.c b/drivers/firmware/arm_scmi/transports/optee.c
index 3949a877e17d..dc0f46340153 100644
--- a/drivers/firmware/arm_scmi/transports/optee.c
+++ b/drivers/firmware/arm_scmi/transports/optee.c
@@ -498,7 +498,7 @@ static void scmi_optee_mark_txdone(struct scmi_chan_info *cinfo, int ret,
 	mutex_unlock(&channel->mu);
 }
 
-static struct scmi_transport_ops scmi_optee_ops = {
+static const struct scmi_transport_ops scmi_optee_ops = {
 	.chan_available = scmi_optee_chan_available,
 	.chan_setup = scmi_optee_chan_setup,
 	.chan_free = scmi_optee_chan_free,
-- 
2.50.1


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

* Re: [PATCH 1/2] firmware: arm_scmi: Constify struct scmi_voltage_proto_ops
  2025-07-29 19:15 [PATCH 1/2] firmware: arm_scmi: Constify struct scmi_voltage_proto_ops Christophe JAILLET
  2025-07-29 19:15 ` [PATCH 2/2] firmware: arm_scmi: Constify struct scmi_transport_ops Christophe JAILLET
@ 2025-08-26 10:37 ` Sudeep Holla
  1 sibling, 0 replies; 3+ messages in thread
From: Sudeep Holla @ 2025-08-26 10:37 UTC (permalink / raw)
  To: Cristian Marussi, Christophe JAILLET
  Cc: Sudeep Holla, linux-kernel, kernel-janitors, arm-scmi,
	linux-arm-kernel

On Tue, 29 Jul 2025 21:15:03 +0200, Christophe JAILLET wrote:
> 'struct scmi_voltage_proto_ops' is not modified in this driver.
> 
> Constifying this structure moves some data to a read-only section, so
> increases overall security, especially when the structure holds some
> function pointers.
> 
> On a x86_64, with allmodconfig, as an example:
> Before:
> ======
>    text	   data	    bss	    dec	    hex	filename
>   13142	   1808	      0	  14950	   3a66	drivers/firmware/arm_scmi/voltage.o
> 
> [...]

Applied to sudeep.holla/linux (for-next/scmi/updates), thanks!

[1/2] firmware: arm_scmi: Constify struct scmi_voltage_proto_ops
      https://git.kernel.org/sudeep.holla/c/abd658d3e733
[2/2] firmware: arm_scmi: Constify struct scmi_transport_ops
      https://git.kernel.org/sudeep.holla/c/224dcf2968ca
--
Regards,
Sudeep


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

end of thread, other threads:[~2025-08-26 10:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-29 19:15 [PATCH 1/2] firmware: arm_scmi: Constify struct scmi_voltage_proto_ops Christophe JAILLET
2025-07-29 19:15 ` [PATCH 2/2] firmware: arm_scmi: Constify struct scmi_transport_ops Christophe JAILLET
2025-08-26 10:37 ` [PATCH 1/2] firmware: arm_scmi: Constify struct scmi_voltage_proto_ops Sudeep Holla

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).