cocci.inria.fr archive mirror
 help / color / mirror / Atom feed
* [Cocci] Determination of failure predicates for selected function calls with SmPL?
@ 2020-03-25 17:00 Markus Elfring
  2020-03-25 17:32 ` Julia Lawall
  0 siblings, 1 reply; 4+ messages in thread
From: Markus Elfring @ 2020-03-25 17:00 UTC (permalink / raw)
  To: Coccinelle

Hello,

I have noticed the patch “tty: serial: fsl_lpuart: fix return value checking”.
https://lore.kernel.org/linux-serial/20200325090658.25967-2-michael@walle.cc/
https://lore.kernel.org/patchwork/patch/1215542/
https://lkml.org/lkml/2020/3/25/202

I am curious if such a software transformation can be extended for similar
source code searches also by the means of the semantic patch language.
The proper knowledge of failure predicates for function calls is a key aspect
for this use case.
Would you like to clarify any corresponding development possibilities?

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

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

* Re: [Cocci] Determination of failure predicates for selected function calls with SmPL?
  2020-03-25 17:00 [Cocci] Determination of failure predicates for selected function calls with SmPL? Markus Elfring
@ 2020-03-25 17:32 ` Julia Lawall
  2020-03-25 18:00   ` Markus Elfring
  2020-03-26  6:45   ` Markus Elfring
  0 siblings, 2 replies; 4+ messages in thread
From: Julia Lawall @ 2020-03-25 17:32 UTC (permalink / raw)
  To: Markus Elfring; +Cc: Coccinelle

[-- Attachment #1: Type: text/plain, Size: 983 bytes --]



On Wed, 25 Mar 2020, Markus Elfring wrote:

> Hello,
>
> I have noticed the patch “tty: serial: fsl_lpuart: fix return value checking”.
> https://lore.kernel.org/linux-serial/20200325090658.25967-2-michael@walle.cc/
> https://lore.kernel.org/patchwork/patch/1215542/
> https://lkml.org/lkml/2020/3/25/202
>
> I am curious if such a software transformation can be extended for similar
> source code searches also by the means of the semantic patch language.
> The proper knowledge of failure predicates for function calls is a key aspect
> for this use case.
> Would you like to clarify any corresponding development possibilities?

I'm not sure what there is to clarify.  One can surely write rules that
find this kind of problem, with a varying rate of false positives.

A simple approach would be to check all occurrences of if (!ret) for an
integer-typed variable, because typically that is the success case.  But
sometimes people do put the success case under an if.

julia

[-- Attachment #2: Type: text/plain, Size: 136 bytes --]

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

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

* Re: [Cocci] Determination of failure predicates for selected function calls with SmPL?
  2020-03-25 17:32 ` Julia Lawall
@ 2020-03-25 18:00   ` Markus Elfring
  2020-03-26  6:45   ` Markus Elfring
  1 sibling, 0 replies; 4+ messages in thread
From: Markus Elfring @ 2020-03-25 18:00 UTC (permalink / raw)
  To: Julia Lawall; +Cc: Coccinelle

>> I have noticed the patch “tty: serial: fsl_lpuart: fix return value checking”.
>> https://lore.kernel.org/linux-serial/20200325090658.25967-2-michael@walle.cc/
> I'm not sure what there is to clarify.

Such an use case can point some software development challenges out.


> One can surely write rules that find this kind of problem,

I know this in principle.


> with a varying rate of false positives.

I am trying again to reduce this special case considerably.


> A simple approach would be to check all occurrences of if (!ret) for an
> integer-typed variable, because typically that is the success case.

I would like to increase the probability for generation of corresponding fixes.

The success predicate can be also the opposite if you would like to take
a Linux macro like access_ok() or valid pointers (after memory allocations
for example) into account.


> But sometimes people do put the success case under an if.

I am curious how often such source code variations should be considered.

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

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

* Re: [Cocci] Determination of failure predicates for selected function calls with SmPL?
  2020-03-25 17:32 ` Julia Lawall
  2020-03-25 18:00   ` Markus Elfring
@ 2020-03-26  6:45   ` Markus Elfring
  1 sibling, 0 replies; 4+ messages in thread
From: Markus Elfring @ 2020-03-26  6:45 UTC (permalink / raw)
  To: Julia Lawall; +Cc: Coccinelle

>> I have noticed the patch “tty: serial: fsl_lpuart: fix return value checking”.
>> https://lore.kernel.org/linux-serial/20200325090658.25967-2-michael@walle.cc/
> I'm not sure what there is to clarify.  One can surely write rules that
> find this kind of problem, with a varying rate of false positives.

Will further changes become more interesting also according to other development
approaches you care for?

* Prequel
  http://prequel-pql.gforge.inria.fr/

* Machine learning for software corrections
  https://hal.inria.fr/hal-02373994
  https://doi.org/10.1109/TSE.2019.2952614

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

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

end of thread, other threads:[~2020-03-26  6:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-25 17:00 [Cocci] Determination of failure predicates for selected function calls with SmPL? Markus Elfring
2020-03-25 17:32 ` Julia Lawall
2020-03-25 18:00   ` Markus Elfring
2020-03-26  6:45   ` Markus Elfring

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).