Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1480788 > unrolled thread

[PATCH 00/26] constify local structures

Started byJulia Lawall <Julia.Lawall@lip6.fr>
First post2016-09-11 15:30 +0200
Last post2016-09-11 21:20 +0200
Articles 9 on this page of 49 — 12 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 00/26] constify local structures Julia Lawall <Julia.Lawall@lip6.fr> - 2016-09-11 15:30 +0200
    [PATCH 02/26] lib: constify local structures Julia Lawall <Julia.Lawall@lip6.fr> - 2016-09-11 15:30 +0200
    [PATCH 13/26] [media]: constify local structures Julia Lawall <Julia.Lawall@lip6.fr> - 2016-09-11 15:30 +0200
    [PATCH 01/26] ALSA: pci: constify local structures Julia Lawall <Julia.Lawall@lip6.fr> - 2016-09-11 15:30 +0200
      Re: [PATCH 01/26] ALSA: pci: constify local structures Takashi Iwai <tiwai@suse.de> - 2016-09-12 08:20 +0200
    [PATCH 24/26] ACPI / APD: constify local structures Julia Lawall <Julia.Lawall@lip6.fr> - 2016-09-11 15:30 +0200
      Re: [PATCH 24/26] ACPI / APD: constify local structures "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-09-14 02:50 +0200
    [PATCH 25/26] pch_gbe: constify local structures Julia Lawall <Julia.Lawall@lip6.fr> - 2016-09-11 15:30 +0200
      Re: [PATCH 25/26] pch_gbe: constify local structures David Miller <davem@davemloft.net> - 2016-09-12 04:50 +0200
        Re: [PATCH 25/26] pch_gbe: constify local structures Julia Lawall <julia.lawall@lip6.fr> - 2016-09-12 11:10 +0200
          Re: [PATCH 25/26] pch_gbe: constify local structures David Miller <davem@davemloft.net> - 2016-09-12 18:40 +0200
      Re: [PATCH 25/26] pch_gbe: constify local structures Julia Lawall <julia.lawall@lip6.fr> - 2016-09-12 14:30 +0200
    [PATCH 22/26] esas2r: constify local structures Julia Lawall <Julia.Lawall@lip6.fr> - 2016-09-11 15:30 +0200
    [PATCH 21/26] rtlwifi: rtl818x: constify local structures Julia Lawall <Julia.Lawall@lip6.fr> - 2016-09-11 15:30 +0200
    [PATCH 15/26] platform/chrome: constify local structures Julia Lawall <Julia.Lawall@lip6.fr> - 2016-09-11 15:40 +0200
    [PATCH 07/26] net/mlx4_core: constify local structures Julia Lawall <Julia.Lawall@lip6.fr> - 2016-09-11 15:40 +0200
      Re: [PATCH 07/26] net/mlx4_core: constify local structures Leon Romanovsky <leon@kernel.org> - 2016-09-12 07:10 +0200
    [PATCH 05/26] ARCNET: constify local structures Julia Lawall <Julia.Lawall@lip6.fr> - 2016-09-11 15:40 +0200
      Re: [PATCH 05/26] ARCNET: constify local structures Julia Lawall <julia.lawall@lip6.fr> - 2016-09-12 14:40 +0200
    [PATCH 04/26] matroxfb: constify local structures Julia Lawall <Julia.Lawall@lip6.fr> - 2016-09-11 15:40 +0200
    [PATCH 18/26] intel_scu_ipc: constify local structures Julia Lawall <Julia.Lawall@lip6.fr> - 2016-09-11 15:40 +0200
      Re: [PATCH 18/26] intel_scu_ipc: constify local structures Julia Lawall <julia.lawall@lip6.fr> - 2016-09-12 14:40 +0200
    [PATCH 03/26] staging: rtl8192e: constify local structures Julia Lawall <Julia.Lawall@lip6.fr> - 2016-09-11 15:40 +0200
    [PATCH 11/26] can: constify local structures Julia Lawall <Julia.Lawall@lip6.fr> - 2016-09-11 15:40 +0200
      Re: [PATCH 11/26] can: constify local structures Julia Lawall <julia.lawall@lip6.fr> - 2016-09-12 14:40 +0200
    [PATCH 08/26] iwlegacy: constify local structures Julia Lawall <Julia.Lawall@lip6.fr> - 2016-09-11 15:40 +0200
      Re: [PATCH 08/26] iwlegacy: constify local structures Stanislaw Gruszka <sgruszka@redhat.com> - 2016-09-12 13:30 +0200
    [PATCH 17/26] intel_telemetry_debugfs: constify local structures Julia Lawall <Julia.Lawall@lip6.fr> - 2016-09-11 15:40 +0200
    [PATCH 19/26] intel_pstate: constify local structures Julia Lawall <Julia.Lawall@lip6.fr> - 2016-09-11 15:40 +0200
      Re: [PATCH 19/26] intel_pstate: constify local structures Viresh Kumar <viresh.kumar@linaro.org> - 2016-09-12 08:50 +0200
        Re: [PATCH 19/26] intel_pstate: constify local structures "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-09-14 03:00 +0200
    [PATCH 10/26] tpm: constify local structures Julia Lawall <Julia.Lawall@lip6.fr> - 2016-09-11 15:40 +0200
      Re: [PATCH 10/26] tpm: constify local structures Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2016-09-11 19:20 +0200
        Re: [PATCH 10/26] tpm: constify local structures Julia Lawall <julia.lawall@lip6.fr> - 2016-09-12 10:50 +0200
      Re: [PATCH 10/26] tpm: constify local structures Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2016-09-12 21:30 +0200
    [PATCH 09/26] i40iw: constify local structures Julia Lawall <Julia.Lawall@lip6.fr> - 2016-09-11 15:40 +0200
    [PATCH 16/26] ezusb: constify local structures Julia Lawall <Julia.Lawall@lip6.fr> - 2016-09-11 15:40 +0200
    Re: [PATCH 00/26] constify local structures Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2016-09-11 19:30 +0200
      Re: [PATCH 00/26] constify local structures Julia Lawall <julia.lawall@lip6.fr> - 2016-09-12 11:00 +0200
        Re: [PATCH 00/26] constify local structures Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2016-09-12 15:20 +0200
          Re: [PATCH 00/26] constify local structures Julia Lawall <julia.lawall@lip6.fr> - 2016-09-12 15:30 +0200
          Re: [PATCH 00/26] constify local structures Felipe Balbi <felipe.balbi@linux.intel.com> - 2016-09-12 15:50 +0200
            Re: [PATCH 00/26] constify local structures Geert Uytterhoeven <geert@linux-m68k.org> - 2016-09-12 16:00 +0200
            Re: [PATCH 00/26] constify local structures Julia Lawall <julia.lawall@lip6.fr> - 2016-09-12 16:00 +0200
              Re: [PATCH 00/26] constify local structures Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2016-09-12 21:00 +0200
            Re: [PATCH 00/26] constify local structures Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2016-09-12 22:20 +0200
              Re: [PATCH 00/26] constify local structures Julia Lawall <julia.lawall@lip6.fr> - 2016-09-12 23:20 +0200
    Re: [PATCH 00/26] constify local structures Joe Perches <joe@perches.com> - 2016-09-11 20:00 +0200
      Re: [PATCH 00/26] constify local structures Julia Lawall <julia.lawall@lip6.fr> - 2016-09-11 21:20 +0200

Page 3 of 3 — ← Prev page 1 2 [3]


#1481276

FromJulia Lawall <julia.lawall@lip6.fr>
Date2016-09-12 15:30 +0200
Message-ID<sgzt8-3QU-23@gated-at.bofh.it>
In reply to#1481271

On Mon, 12 Sep 2016, Jarkko Sakkinen wrote:

> On Mon, Sep 12, 2016 at 10:54:07AM +0200, Julia Lawall wrote:
> >
> >
> > On Sun, 11 Sep 2016, Jarkko Sakkinen wrote:
> >
> > > On Sun, Sep 11, 2016 at 03:05:42PM +0200, Julia Lawall wrote:
> > > > Constify local structures.
> > > >
> > > > The semantic patch that makes this change is as follows:
> > > > (http://coccinelle.lip6.fr/)
> > >
> > > Just my two cents but:
> > >
> > > 1. You *can* use a static analysis too to find bugs or other issues.
> > > 2. However, you should manually do the commits and proper commit
> > >    messages to subsystems based on your findings. And I generally think
> > >    that if one contributes code one should also at least smoke test changes
> > >    somehow.
> > >
> > > I don't know if I'm alone with my opinion. I just think that one should
> > > also do the analysis part and not blindly create and submit patches.
> >
> > All of the patches are compile tested.  And the individual patches are
>
> Compile-testing is not testing. If you are not able to test a commit,
> you should explain why.
>
> > submitted to the relevant maintainers.  The individual commit messages
> > give a more detailed explanation of the strategy used to decide that the
> > structure was constifiable.  It seemed redundant to put that in the cover
> > letter, which will not be committed anyway.
>
> I don't mean to be harsh but I do not care about your thought process
> *that much* when I review a commit (sometimes it might make sense to
> explain that but it depends on the context).
>
> I mostly only care why a particular change makes sense for this
> particular subsystem. The report given by a static analysis tool can
> be a starting point for making a commit but it's not sufficient.
> Based on the report you should look subsystems as individuals.

OK, thanks for the feedback.

julia

[toc] | [prev] | [next] | [standalone]


#1481297

FromFelipe Balbi <felipe.balbi@linux.intel.com>
Date2016-09-12 15:50 +0200
Message-ID<sgzMt-3XR-19@gated-at.bofh.it>
In reply to#1481271

[Multipart message — attachments visible in raw view] — view raw

Hi,

Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> writes:
> On Mon, Sep 12, 2016 at 10:54:07AM +0200, Julia Lawall wrote:
>> 
>> 
>> On Sun, 11 Sep 2016, Jarkko Sakkinen wrote:
>> 
>> > On Sun, Sep 11, 2016 at 03:05:42PM +0200, Julia Lawall wrote:
>> > > Constify local structures.
>> > >
>> > > The semantic patch that makes this change is as follows:
>> > > (http://coccinelle.lip6.fr/)
>> >
>> > Just my two cents but:
>> >
>> > 1. You *can* use a static analysis too to find bugs or other issues.
>> > 2. However, you should manually do the commits and proper commit
>> >    messages to subsystems based on your findings. And I generally think
>> >    that if one contributes code one should also at least smoke test changes
>> >    somehow.
>> >
>> > I don't know if I'm alone with my opinion. I just think that one should
>> > also do the analysis part and not blindly create and submit patches.
>> 
>> All of the patches are compile tested.  And the individual patches are
>
> Compile-testing is not testing. If you are not able to test a commit,
> you should explain why.

Dude, Julia has been doing semantic patching for years already and
nobody has raised any concerns so far. There's already an expectation
that Coccinelle *works* and Julia's sematic patches are sound.

Besides, adding 'const' is something that causes virtually no functional
changes to the point that build-testing is really all you need. Any
problems caused by adding 'const' to a definition will be seen by build
errors or warnings.

Really, just stop with the pointless discussion and go read a bit about
Coccinelle and what semantic patches are giving you. The work done by
Julia and her peers are INRIA have measurable benefits.

You're really making a thunderstorm in a glass of water.

-- 
balbi

[toc] | [prev] | [next] | [standalone]


#1481305

FromGeert Uytterhoeven <geert@linux-m68k.org>
Date2016-09-12 16:00 +0200
Message-ID<sgzW9-41n-11@gated-at.bofh.it>
In reply to#1481297
On Mon, Sep 12, 2016 at 3:43 PM, Felipe Balbi
<felipe.balbi@linux.intel.com> wrote:
> Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> writes:
>> On Mon, Sep 12, 2016 at 10:54:07AM +0200, Julia Lawall wrote:
>>> On Sun, 11 Sep 2016, Jarkko Sakkinen wrote:
>>> > On Sun, Sep 11, 2016 at 03:05:42PM +0200, Julia Lawall wrote:
>>> > > Constify local structures.
>>> > >
>>> > > The semantic patch that makes this change is as follows:
>>> > > (http://coccinelle.lip6.fr/)
>>> >
>>> > Just my two cents but:
>>> >
>>> > 1. You *can* use a static analysis too to find bugs or other issues.
>>> > 2. However, you should manually do the commits and proper commit
>>> >    messages to subsystems based on your findings. And I generally think
>>> >    that if one contributes code one should also at least smoke test changes
>>> >    somehow.
>>> >
>>> > I don't know if I'm alone with my opinion. I just think that one should
>>> > also do the analysis part and not blindly create and submit patches.
>>>
>>> All of the patches are compile tested.  And the individual patches are
>>
>> Compile-testing is not testing. If you are not able to test a commit,
>> you should explain why.
>
> Dude, Julia has been doing semantic patching for years already and
> nobody has raised any concerns so far. There's already an expectation
> that Coccinelle *works* and Julia's sematic patches are sound.

+1

> Besides, adding 'const' is something that causes virtually no functional
> changes to the point that build-testing is really all you need. Any
> problems caused by adding 'const' to a definition will be seen by build
> errors or warnings.

Unfortunately in this particular case they could lead to failures that can only
be detected at runtime, when failing o write to a read-only piece of memory,
due to the casting away of the constness of the pointers later.
Fortunately this was detected during code review (doh...).

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

[toc] | [prev] | [next] | [standalone]


#1481309

FromJulia Lawall <julia.lawall@lip6.fr>
Date2016-09-12 16:00 +0200
Message-ID<sgzWa-41n-45@gated-at.bofh.it>
In reply to#1481297

On Mon, 12 Sep 2016, Felipe Balbi wrote:

>
> Hi,
>
> Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> writes:
> > On Mon, Sep 12, 2016 at 10:54:07AM +0200, Julia Lawall wrote:
> >>
> >>
> >> On Sun, 11 Sep 2016, Jarkko Sakkinen wrote:
> >>
> >> > On Sun, Sep 11, 2016 at 03:05:42PM +0200, Julia Lawall wrote:
> >> > > Constify local structures.
> >> > >
> >> > > The semantic patch that makes this change is as follows:
> >> > > (http://coccinelle.lip6.fr/)
> >> >
> >> > Just my two cents but:
> >> >
> >> > 1. You *can* use a static analysis too to find bugs or other issues.
> >> > 2. However, you should manually do the commits and proper commit
> >> >    messages to subsystems based on your findings. And I generally think
> >> >    that if one contributes code one should also at least smoke test changes
> >> >    somehow.
> >> >
> >> > I don't know if I'm alone with my opinion. I just think that one should
> >> > also do the analysis part and not blindly create and submit patches.
> >>
> >> All of the patches are compile tested.  And the individual patches are
> >
> > Compile-testing is not testing. If you are not able to test a commit,
> > you should explain why.
>
> Dude, Julia has been doing semantic patching for years already and
> nobody has raised any concerns so far. There's already an expectation
> that Coccinelle *works* and Julia's sematic patches are sound.
>
> Besides, adding 'const' is something that causes virtually no functional
> changes to the point that build-testing is really all you need. Any
> problems caused by adding 'const' to a definition will be seen by build
> errors or warnings.
>
> Really, just stop with the pointless discussion and go read a bit about
> Coccinelle and what semantic patches are giving you. The work done by
> Julia and her peers are INRIA have measurable benefits.
>
> You're really making a thunderstorm in a glass of water.

Thanks for the defense, but since a lot of these patches torned out to be
wrong, due to an incorrect parse by Coccinelle, combined with an
unpleasantly lax compiler, Jarkko does have a point that I should have
looked at the patches more carefully.  In any case, I have written to the
maintainers relevant to the patches that turned out to be incorrect.

julia

[toc] | [prev] | [next] | [standalone]


#1481836

FromJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Date2016-09-12 21:00 +0200
Message-ID<sgECt-7at-5@gated-at.bofh.it>
In reply to#1481309
On Mon, Sep 12, 2016 at 03:52:08PM +0200, Julia Lawall wrote:
> 
> 
> On Mon, 12 Sep 2016, Felipe Balbi wrote:
> 
> >
> > Hi,
> >
> > Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> writes:
> > > On Mon, Sep 12, 2016 at 10:54:07AM +0200, Julia Lawall wrote:
> > >>
> > >>
> > >> On Sun, 11 Sep 2016, Jarkko Sakkinen wrote:
> > >>
> > >> > On Sun, Sep 11, 2016 at 03:05:42PM +0200, Julia Lawall wrote:
> > >> > > Constify local structures.
> > >> > >
> > >> > > The semantic patch that makes this change is as follows:
> > >> > > (http://coccinelle.lip6.fr/)
> > >> >
> > >> > Just my two cents but:
> > >> >
> > >> > 1. You *can* use a static analysis too to find bugs or other issues.
> > >> > 2. However, you should manually do the commits and proper commit
> > >> >    messages to subsystems based on your findings. And I generally think
> > >> >    that if one contributes code one should also at least smoke test changes
> > >> >    somehow.
> > >> >
> > >> > I don't know if I'm alone with my opinion. I just think that one should
> > >> > also do the analysis part and not blindly create and submit patches.
> > >>
> > >> All of the patches are compile tested.  And the individual patches are
> > >
> > > Compile-testing is not testing. If you are not able to test a commit,
> > > you should explain why.
> >
> > Dude, Julia has been doing semantic patching for years already and
> > nobody has raised any concerns so far. There's already an expectation
> > that Coccinelle *works* and Julia's sematic patches are sound.
> >
> > Besides, adding 'const' is something that causes virtually no functional
> > changes to the point that build-testing is really all you need. Any
> > problems caused by adding 'const' to a definition will be seen by build
> > errors or warnings.
> >
> > Really, just stop with the pointless discussion and go read a bit about
> > Coccinelle and what semantic patches are giving you. The work done by
> > Julia and her peers are INRIA have measurable benefits.
> >
> > You're really making a thunderstorm in a glass of water.
> 
> Thanks for the defense, but since a lot of these patches torned out to be
> wrong, due to an incorrect parse by Coccinelle, combined with an
> unpleasantly lax compiler, Jarkko does have a point that I should have
> looked at the patches more carefully.  In any case, I have written to the
> maintainers relevant to the patches that turned out to be incorrect.

Exactly. I'm not excepting that every commit would require extensive
analysis but it would be good to quickly at least skim through commits
and see if they make sense (or ask if unsure) :) 

And I'm fine with compile testing if it is mentioned in the commit msg.

> julia

/Jarkko

[toc] | [prev] | [next] | [standalone]


#1481936

FromJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Date2016-09-12 22:20 +0200
Message-ID<sgFRU-8ja-21@gated-at.bofh.it>
In reply to#1481297
On Mon, Sep 12, 2016 at 04:43:58PM +0300, Felipe Balbi wrote:
> 
> Hi,
> 
> Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> writes:
> > On Mon, Sep 12, 2016 at 10:54:07AM +0200, Julia Lawall wrote:
> >> 
> >> 
> >> On Sun, 11 Sep 2016, Jarkko Sakkinen wrote:
> >> 
> >> > On Sun, Sep 11, 2016 at 03:05:42PM +0200, Julia Lawall wrote:
> >> > > Constify local structures.
> >> > >
> >> > > The semantic patch that makes this change is as follows:
> >> > > (http://coccinelle.lip6.fr/)
> >> >
> >> > Just my two cents but:
> >> >
> >> > 1. You *can* use a static analysis too to find bugs or other issues.
> >> > 2. However, you should manually do the commits and proper commit
> >> >    messages to subsystems based on your findings. And I generally think
> >> >    that if one contributes code one should also at least smoke test changes
> >> >    somehow.
> >> >
> >> > I don't know if I'm alone with my opinion. I just think that one should
> >> > also do the analysis part and not blindly create and submit patches.
> >> 
> >> All of the patches are compile tested.  And the individual patches are
> >
> > Compile-testing is not testing. If you are not able to test a commit,
> > you should explain why.
> 
> Dude, Julia has been doing semantic patching for years already and
> nobody has raised any concerns so far. There's already an expectation
> that Coccinelle *works* and Julia's sematic patches are sound.
> 
> Besides, adding 'const' is something that causes virtually no functional
> changes to the point that build-testing is really all you need. Any
> problems caused by adding 'const' to a definition will be seen by build
> errors or warnings.
> 
> Really, just stop with the pointless discussion and go read a bit about
> Coccinelle and what semantic patches are giving you. The work done by
> Julia and her peers are INRIA have measurable benefits.
> 
> You're really making a thunderstorm in a glass of water.

Hmm... I've been using coccinelle in cyclic basis for some time now.
My comment was oversized but I didn't mean it to be impolite or attack
of any kind for that matter.

> -- 
> balbi

/Jarkko

[toc] | [prev] | [next] | [standalone]


#1481986

FromJulia Lawall <julia.lawall@lip6.fr>
Date2016-09-12 23:20 +0200
Message-ID<sgGNY-yl-11@gated-at.bofh.it>
In reply to#1481936

On Mon, 12 Sep 2016, Jarkko Sakkinen wrote:

> On Mon, Sep 12, 2016 at 04:43:58PM +0300, Felipe Balbi wrote:
> >
> > Hi,
> >
> > Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> writes:
> > > On Mon, Sep 12, 2016 at 10:54:07AM +0200, Julia Lawall wrote:
> > >>
> > >>
> > >> On Sun, 11 Sep 2016, Jarkko Sakkinen wrote:
> > >>
> > >> > On Sun, Sep 11, 2016 at 03:05:42PM +0200, Julia Lawall wrote:
> > >> > > Constify local structures.
> > >> > >
> > >> > > The semantic patch that makes this change is as follows:
> > >> > > (http://coccinelle.lip6.fr/)
> > >> >
> > >> > Just my two cents but:
> > >> >
> > >> > 1. You *can* use a static analysis too to find bugs or other issues.
> > >> > 2. However, you should manually do the commits and proper commit
> > >> >    messages to subsystems based on your findings. And I generally think
> > >> >    that if one contributes code one should also at least smoke test changes
> > >> >    somehow.
> > >> >
> > >> > I don't know if I'm alone with my opinion. I just think that one should
> > >> > also do the analysis part and not blindly create and submit patches.
> > >>
> > >> All of the patches are compile tested.  And the individual patches are
> > >
> > > Compile-testing is not testing. If you are not able to test a commit,
> > > you should explain why.
> >
> > Dude, Julia has been doing semantic patching for years already and
> > nobody has raised any concerns so far. There's already an expectation
> > that Coccinelle *works* and Julia's sematic patches are sound.
> >
> > Besides, adding 'const' is something that causes virtually no functional
> > changes to the point that build-testing is really all you need. Any
> > problems caused by adding 'const' to a definition will be seen by build
> > errors or warnings.
> >
> > Really, just stop with the pointless discussion and go read a bit about
> > Coccinelle and what semantic patches are giving you. The work done by
> > Julia and her peers are INRIA have measurable benefits.
> >
> > You're really making a thunderstorm in a glass of water.
>
> Hmm... I've been using coccinelle in cyclic basis for some time now.
> My comment was oversized but I didn't mean it to be impolite or attack
> of any kind for that matter.

No problem :)  Thanks for the feedback.

julia

[toc] | [prev] | [next] | [standalone]


#1480845

FromJoe Perches <joe@perches.com>
Date2016-09-11 20:00 +0200
Message-ID<sghcS-Kv-3@gated-at.bofh.it>
In reply to#1480788
On Sun, 2016-09-11 at 15:05 +0200, Julia Lawall wrote:
> Constify local structures.

Thanks Julia.

A few suggestions & questions:

Perhaps the script should go into scripts/coccinelle/
so that future cases could be caught by the robot
and commit message referenced by the patch instances.

Can you please compile the files modified using the
appropriate defconfig/allyesconfig and show the
movement from data to const by using
	$ size <object>.new/old
and include that in the changelogs (maybe next time)?

Is it possible for a rule to trace the instances where
an address of a struct or struct member is taken by
locally defined and declared function call where the
callee does not modify any dereferenced object?

ie:

struct foo {
	int bar;
	char *baz;
};

struct foo qux[] = {
	{ 1, "description 1" },
	{ 2, "dewcription 2" },
	[ n, "etc" ]...,
};

void message(struct foo *msg)
{
	printk("%d %s\n", msg->bar, msg->baz);
}

where some code uses

	message(qux[index]);

So could a coccinelle script change:

struct foo qux[] = { to const struct foo quz[] = {

and

void message(struct foo *msg) to void message(const struct foo *msg)

[toc] | [prev] | [next] | [standalone]


#1480855

FromJulia Lawall <julia.lawall@lip6.fr>
Date2016-09-11 21:20 +0200
Message-ID<sgisi-1Eo-9@gated-at.bofh.it>
In reply to#1480845
On Sun, 11 Sep 2016, Joe Perches wrote:

> On Sun, 2016-09-11 at 15:05 +0200, Julia Lawall wrote:
> > Constify local structures.
>
> Thanks Julia.
>
> A few suggestions & questions:
>
> Perhaps the script should go into scripts/coccinelle/
> so that future cases could be caught by the robot
> and commit message referenced by the patch instances.

OK.

> Can you please compile the files modified using the
> appropriate defconfig/allyesconfig and show the

I currently send patches for this issue only for files that compile using
the x86 allyesconfig.

> movement from data to const by using
> 	$ size <object>.new/old
> and include that in the changelogs (maybe next time)?

OK, thanks for the suggestion.

> Is it possible for a rule to trace the instances where
> an address of a struct or struct member is taken by
> locally defined and declared function call where the
> callee does not modify any dereferenced object?
>
> ie:
>
> struct foo {
> 	int bar;
> 	char *baz;
> };
>
> struct foo qux[] = {
> 	{ 1, "description 1" },
> 	{ 2, "dewcription 2" },
> 	[ n, "etc" ]...,
> };
>
> void message(struct foo *msg)
> {
> 	printk("%d %s\n", msg->bar, msg->baz);
> }
>
> where some code uses
>
> 	message(qux[index]);
>
> So could a coccinelle script change:
>
> struct foo qux[] = { to const struct foo quz[] = {
>
> and
>
> void message(struct foo *msg) to void message(const struct foo *msg)

Yes, this could be possible too.

Thanks for the feedback.

julia

[toc] | [prev] | [standalone]


Page 3 of 3 — ← Prev page 1 2 [3]

Back to top | Article view | linux.kernel


csiph-web