All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: Julia Lawall <Julia.Lawall@lip6.fr>
Cc: Coccinelle <cocci@systeme.lip6.fr>
Subject: Re: [Cocci] xusb-tegra186: Adding a function call behind a label with SmPL?
Date: Thu, 31 Oct 2019 09:12:38 +0100	[thread overview]
Message-ID: <d75163a7-e30f-e9b2-8670-a49b86164a9e@web.de> (raw)
In-Reply-To: <2db8691d768571f6c275f3d89401df23@lip6.fr>

>> @addition@
>> expression object;
>> @@
>>  object = kzalloc(...)
>>  ... when any
>>  device_unregister(...);
>>  out:
>> +kfree(object);
>>  return ERR_PTR(...);
>
> There is no reason why a patch should be generated in this case.

We come along different software development views also for this use case.
I tend still to interpret some of my source code search patterns in other directions.


> As you should know well, A ... B only matches in a transformation case
> if every path from A leads to code matching B.

Now I imagine that an explanation of such information can become more interesting
also based on the applied technologies as a knowledge background.
https://github.com/coccinelle/coccinelle/blob/ed1eb8e06f800739d3992158d36945c0c4c6f0c7/docs/manual/cocci_syntax.tex#L860

https://en.wikipedia.org/wiki/Computation_tree_logic#Relations_with_other_logics


> That is not the case in your example.

The shown SmPL script can probably indicate that a return statement should occasionally
be executed if a jump to it (according to the label “out” for example) was performed before
(in one if branch).

The following simple transformation approach seems to work also in the way
which I expected somehow initially.

@addition@
expression object;
@@
 object = kzalloc(...)
 ... when exists
 device_unregister(...);
 out:
+kfree(object);
 return ERR_PTR(...);


Can any extensions for the software documentation help to make the application
of the semantic patch language easier and safer finally?

Regards,
Markus
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

  parent reply	other threads:[~2019-10-31  8:13 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-28 21:20 phy: tegra: xusb: Complete exception handling in five probe functions Markus Elfring
2019-10-28 21:20 ` Markus Elfring
2019-10-29  9:40 ` [Cocci] phy: tegra: xusb: Complete exception handling in " Markus Elfring
2019-10-29  9:40   ` Markus Elfring
2019-10-29  9:40   ` Markus Elfring
2019-10-30 10:44   ` [Cocci] drivers/phy/tegra: Completion for exception handling in probe functions with SmPL? Markus Elfring
2019-10-30 10:44     ` Markus Elfring
2019-10-30 10:44     ` Markus Elfring
2019-10-30 17:30     ` [Cocci] xusb-tegra186: Renaming known jump labels " Markus Elfring
2019-10-30 18:15     ` [Cocci] xusb-tegra186: Adding a function call behind a label " Markus Elfring
     [not found]       ` <2db8691d768571f6c275f3d89401df23@lip6.fr>
2019-10-30 20:00         ` Markus Elfring
2019-10-30 20:44           ` Julia Lawall
2019-10-31  8:12         ` Markus Elfring [this message]
2019-10-30 20:50     ` [Cocci] drivers/phy/tegra: Completion for exception handling in probe functions " Markus Elfring
2019-10-30 20:50       ` Markus Elfring
2019-10-30 20:50       ` Markus Elfring

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d75163a7-e30f-e9b2-8670-a49b86164a9e@web.de \
    --to=markus.elfring@web.de \
    --cc=Julia.Lawall@lip6.fr \
    --cc=cocci@systeme.lip6.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.