2024-05-13 17:38:29

by Christophe JAILLET

[permalink] [raw]
Subject: [PATCH 4/6] ASoC: Intel: Skylake: Constify struct snd_soc_tplg_ops

Constifying "struct snd_soc_tplg_ops" moves some data to a read-only
section, so increase overall security.

On a x86_64, with allmodconfig:
Before:
text data bss dec hex filename
58844 5282 56 64182 fab6 sound/soc/intel/skylake/skl-topology.o

After:
text data bss dec hex filename
59004 5122 56 64182 fab6 sound/soc/intel/skylake/skl-topology.o

Signed-off-by: Christophe JAILLET <[email protected]>
---
Compile tested-only.
---
sound/soc/intel/skylake/skl-topology.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/intel/skylake/skl-topology.c b/sound/soc/intel/skylake/skl-topology.c
index e27f0fc3d897..602ef4321122 100644
--- a/sound/soc/intel/skylake/skl-topology.c
+++ b/sound/soc/intel/skylake/skl-topology.c
@@ -3470,7 +3470,7 @@ static int skl_tplg_complete(struct snd_soc_component *component)
return 0;
}

-static struct snd_soc_tplg_ops skl_tplg_ops = {
+static const struct snd_soc_tplg_ops skl_tplg_ops = {
.widget_load = skl_tplg_widget_load,
.control_load = skl_tplg_control_load,
.bytes_ext_ops = skl_tlv_ops,
--
2.45.0



2024-05-14 12:31:54

by Amadeusz Sławiński

[permalink] [raw]
Subject: Re: [PATCH 4/6] ASoC: Intel: Skylake: Constify struct snd_soc_tplg_ops

On 5/13/2024 7:37 PM, Christophe JAILLET wrote:
> Constifying "struct snd_soc_tplg_ops" moves some data to a read-only
> section, so increase overall security.
>
> On a x86_64, with allmodconfig:
> Before:
> text data bss dec hex filename
> 58844 5282 56 64182 fab6 sound/soc/intel/skylake/skl-topology.o
>
> After:
> text data bss dec hex filename
> 59004 5122 56 64182 fab6 sound/soc/intel/skylake/skl-topology.o
>
> Signed-off-by: Christophe JAILLET <[email protected]>
> ---

Reviewed-by: Amadeusz Sławiński <[email protected]>