cocci.inria.fr archive mirror
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: Julia Lawall <julia.lawall@inria.fr>
Cc: Coccinelle <cocci@systeme.lip6.fr>
Subject: Re: [Cocci] Determination of failure predicates for selected function calls with SmPL?
Date: Wed, 25 Mar 2020 19:00:09 +0100	[thread overview]
Message-ID: <6658f112-0e62-498a-2947-165330d06bfe@web.de> (raw)
In-Reply-To: <alpine.DEB.2.21.2003251830510.2306@hadrien>

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

  reply	other threads:[~2020-03-25 18:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2020-03-26  6:45   ` 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=6658f112-0e62-498a-2947-165330d06bfe@web.de \
    --to=markus.elfring@web.de \
    --cc=cocci@systeme.lip6.fr \
    --cc=julia.lawall@inria.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 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).