mbox series

[0/3] pinctrl: meson: Constify some structure

Message ID cover.1723022467.git.christophe.jaillet@wanadoo.fr (mailing list archive)
Headers show
Series pinctrl: meson: Constify some structure | expand

Message

Christophe JAILLET Aug. 7, 2024, 9:30 a.m. UTC
These 3 patches constify some structures in order to move some data to a
read-only section, so increase overall security.

It is splitted in 3 to ease review.
Patch 1: struct meson_pmx_group and meson_pmx_func
patch 2: struct meson_bank
patch 3: struct meson_pmx_bank

All patches are only compile tested.

In order to compile them, I update Kconfig to add some "| COMPILE_TEST"
on depends line.
Should it be useful, I can send a patch to add it, but I don't think it
would be that useful.

On a x86_64, with allmodconfig:
Before:
======
   text	   data	    bss	    dec	    hex	filename
  10818	  11696	      0	  22514	   57f2	drivers/pinctrl/meson/pinctrl-amlogic-c3.o
  17198	  17680	      0	  34878	   883e	drivers/pinctrl/meson/pinctrl-amlogic-t7.o
  14161	  11200	      0	  25361	   6311	drivers/pinctrl/meson/pinctrl-meson8b.o
  17348	  12512	      0	  29860	   74a4	drivers/pinctrl/meson/pinctrl-meson8.o
   3070	    324	      0	   3394	    d42	drivers/pinctrl/meson/pinctrl-meson8-pmx.o
   9317	   9648	      0	  18965	   4a15	drivers/pinctrl/meson/pinctrl-meson-a1.o
  12115	  11664	      0	  23779	   5ce3	drivers/pinctrl/meson/pinctrl-meson-axg.o
   2470	    120	      0	   2590	    a1e	drivers/pinctrl/meson/pinctrl-meson-axg-pmx.o
  15125	  15224	      0	  30349	   768d	drivers/pinctrl/meson/pinctrl-meson-g12a.o
  13800	  10160	      0	  23960	   5d98	drivers/pinctrl/meson/pinctrl-meson-gxbb.o
  13040	   9648	      0	  22688	   58a0	drivers/pinctrl/meson/pinctrl-meson-gxl.o
  20507	   1132	     48	  21687	   54b7	drivers/pinctrl/meson/pinctrl-meson.o
  12212	  12880	      0	  25092	   6204	drivers/pinctrl/meson/pinctrl-meson-s4.o

After:
=====
   text	   data	    bss	    dec	    hex	filename
  22114	    384	      0	  22498	   57e2	drivers/pinctrl/meson/pinctrl-amlogic-c3.o
  34510	    384	      0	  34894	   884e	drivers/pinctrl/meson/pinctrl-amlogic-t7.o
  24945	    440	      0	  25385	   6329	drivers/pinctrl/meson/pinctrl-meson8b.o
  29412	    440	      0	  29852	   749c	drivers/pinctrl/meson/pinctrl-meson8.o
   3070	    324	      0	   3394	    d42	drivers/pinctrl/meson/pinctrl-meson8-pmx.o
  18597	    384	      0	  18981	   4a25	drivers/pinctrl/meson/pinctrl-meson-a1.o
  23315	    496	      0	  23811	   5d03	drivers/pinctrl/meson/pinctrl-meson-axg.o
   2470	    120	      0	   2590	    a1e	drivers/pinctrl/meson/pinctrl-meson-axg-pmx.o
  29877	    504	      0	  30381	   76ad	drivers/pinctrl/meson/pinctrl-meson-g12a.o
  23496	    456	      0	  23952	   5d90	drivers/pinctrl/meson/pinctrl-meson-gxbb.o
  22224	    456	      0	  22680	   5898	drivers/pinctrl/meson/pinctrl-meson-gxl.o
  20507	   1132	     48	  21687	   54b7	drivers/pinctrl/meson/pinctrl-meson.o
  24692	    384	      0	  25076	   61f4	drivers/pinctrl/meson/pinctrl-meson-s4.o

Christophe JAILLET (3):
  pinctrl: meson: Constify struct meson_pmx_group and meson_pmx_func
  pinctrl: meson: Constify struct meson_bank
  pinctrl: meson: Constify struct meson_pmx_bank

 drivers/pinctrl/meson/pinctrl-amlogic-c3.c    |  8 +++---
 drivers/pinctrl/meson/pinctrl-amlogic-t7.c    |  8 +++---
 drivers/pinctrl/meson/pinctrl-meson-a1.c      |  8 +++---
 drivers/pinctrl/meson/pinctrl-meson-axg-pmx.c | 12 ++++-----
 drivers/pinctrl/meson/pinctrl-meson-axg-pmx.h |  2 +-
 drivers/pinctrl/meson/pinctrl-meson-axg.c     | 16 ++++++------
 drivers/pinctrl/meson/pinctrl-meson-g12a.c    | 16 ++++++------
 drivers/pinctrl/meson/pinctrl-meson-gxbb.c    | 12 ++++-----
 drivers/pinctrl/meson/pinctrl-meson-gxl.c     | 12 ++++-----
 drivers/pinctrl/meson/pinctrl-meson-s4.c      |  8 +++---
 drivers/pinctrl/meson/pinctrl-meson.c         | 25 ++++++++++---------
 drivers/pinctrl/meson/pinctrl-meson.h         |  6 ++---
 drivers/pinctrl/meson/pinctrl-meson8-pmx.c    |  6 ++---
 drivers/pinctrl/meson/pinctrl-meson8.c        | 12 ++++-----
 drivers/pinctrl/meson/pinctrl-meson8b.c       | 12 ++++-----
 15 files changed, 82 insertions(+), 81 deletions(-)

Comments

Jerome Brunet Aug. 7, 2024, 2:14 p.m. UTC | #1
On Wed 07 Aug 2024 at 11:30, Christophe JAILLET <christophe.jaillet@wanadoo.fr> wrote:

> These 3 patches constify some structures in order to move some data to a
> read-only section, so increase overall security.
>
> It is splitted in 3 to ease review.

I'm not entirely sure it eases review in this case.
If a v2 is necessary, I think a single patch would be better.

> Patch 1: struct meson_pmx_group and meson_pmx_func
> patch 2: struct meson_bank
> patch 3: struct meson_pmx_bank

Is there any reason for leaving out 'struct meson_pinctrl_data' and
'struct meson_axg_pmx_data' ? I don't think they get modified but maybe
I missed it.

>
> All patches are only compile tested.

Looks good anyway
Reviewed-by: Jerome Brunet <jbrunet@baylibre.com>

On the vim3l:
Tested-by: Jerome Brunet <jbrunet@baylibre.com>
Christophe JAILLET Aug. 7, 2024, 3:08 p.m. UTC | #2
Le 07/08/2024 à 16:14, Jerome Brunet a écrit :
> On Wed 07 Aug 2024 at 11:30, Christophe JAILLET <christophe.jaillet@wanadoo.fr> wrote:
> 
>> These 3 patches constify some structures in order to move some data to a
>> read-only section, so increase overall security.
>>
>> It is splitted in 3 to ease review.
> 
> I'm not entirely sure it eases review in this case.
> If a v2 is necessary, I think a single patch would be better.
> 
>> Patch 1: struct meson_pmx_group and meson_pmx_func
>> patch 2: struct meson_bank
>> patch 3: struct meson_pmx_bank
> 
> Is there any reason for leaving out 'struct meson_pinctrl_data' and
> 'struct meson_axg_pmx_data' ? I don't think they get modified but maybe
> I missed it.

No good reasons.

I'll send a v2 with everything constified all at once.

Should I take the R-b and T-b below, for the v2?


Thanks for the review and comment.

CJ

> 
>>
>> All patches are only compile tested.
> 
> Looks good anyway
> Reviewed-by: Jerome Brunet <jbrunet@baylibre.com>
> 
> On the vim3l:
> Tested-by: Jerome Brunet <jbrunet@baylibre.com>
> 
>
Jerome Brunet Aug. 7, 2024, 3:22 p.m. UTC | #3
On Wed 07 Aug 2024 at 17:08, Christophe JAILLET <christophe.jaillet@wanadoo.fr> wrote:

> Le 07/08/2024 à 16:14, Jerome Brunet a écrit :
>> On Wed 07 Aug 2024 at 11:30, Christophe JAILLET <christophe.jaillet@wanadoo.fr> wrote:
>> 
>>> These 3 patches constify some structures in order to move some data to a
>>> read-only section, so increase overall security.
>>>
>>> It is splitted in 3 to ease review.
>> I'm not entirely sure it eases review in this case.
>> If a v2 is necessary, I think a single patch would be better.
>> 
>>> Patch 1: struct meson_pmx_group and meson_pmx_func
>>> patch 2: struct meson_bank
>>> patch 3: struct meson_pmx_bank
>> Is there any reason for leaving out 'struct meson_pinctrl_data' and
>> 'struct meson_axg_pmx_data' ? I don't think they get modified but maybe
>> I missed it.
>
> No good reasons.
>
> I'll send a v2 with everything constified all at once.
>
> Should I take the R-b and T-b below, for the v2?
>

Leave them out. I'll test again and report.
Thanks for this

>
> Thanks for the review and comment.
>
> CJ
>
>> 
>>>
>>> All patches are only compile tested.
>> Looks good anyway
>> Reviewed-by: Jerome Brunet <jbrunet@baylibre.com>
>> On the vim3l:
>> Tested-by: Jerome Brunet <jbrunet@baylibre.com>
>>