From: Markus Elfring <Markus.Elfring@web.de>
To: cocci@inria.fr
Subject: Re: [cocci] Analysing statement sequences in consistent ways (with SmPL)?
Date: Wed, 22 May 2024 15:55:55 +0200 [thread overview]
Message-ID: <4c2812f7-d54d-412b-ac79-c650ceedcecd@web.de> (raw)
In-Reply-To: <550803c2-45e1-4baa-b316-156ccef51390@web.de>
> @usage@
> expression context, ex;
> identifier member;
> @@
> *kfree(context);
> ... when != context = ex
> when any
> *(context)->member
The small size of such a script for the semantic patch language is helpful
for the clarification of data processing consequences.
Unfortunately, this source code search approach is still too simple.
It can generate diff outputs which need to be interpreted as false positives.
Example:
https://elixir.bootlin.com/linux/v6.9.1/source/drivers/ata/libata-core.c#L5941
…
@@ -5897,12 +5897,9 @@ int ata_host_register(struct ata_host *h
* allocation time.
*/
for (i = host->n_ports; host->ports[i]; i++)
- kfree(host->ports[i]);
/* give ports names and add SCSI hosts */
for (i = 0; i < host->n_ports; i++) {
- host->ports[i]->print_id = atomic_inc_return(&ata_print_id);
- host->ports[i]->local_port_no = i + 1;
}
…
I guess that such a test case points known software limitations
and remaining development challenges out.
See also:
Support source code scopes
2023-10-23
https://github.com/coccinelle/coccinelle/issues/322
Regards,
Markus
prev parent reply other threads:[~2024-05-22 13:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-21 15:12 [cocci] Determining the statement end according to a pointer dereference (with SmPL)? Markus Elfring
2024-05-22 13:55 ` Markus Elfring [this message]
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=4c2812f7-d54d-412b-ac79-c650ceedcecd@web.de \
--to=markus.elfring@web.de \
--cc=cocci@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 read-only IMAP folder(s) and NNTP newsgroup(s).