* Re: [Cocci] Coccinelle: Checking the deletion of duplicate of_node_put() calls with SmPL [not found] <1562566745-7447-2-git-send-email-wen.yang99@zte.com.cn> @ 2019-07-09 12:14 ` Markus Elfring 2019-07-10 5:55 ` Markus Elfring 0 siblings, 1 reply; 2+ messages in thread From: Markus Elfring @ 2019-07-09 12:14 UTC (permalink / raw) To: Wen Yang, Julia Lawall, Coccinelle Cc: Yi Wang, Herbert Xu, Greg Kroah-Hartman, LKML, Armijn Hemel, linux-crypto, Xue Zhihong, Cheng Shengyu, Thomas Gleixner, David S. Miller, Allison Randal > 110: ierr_out: > 111: of_node_put(trng); ---> double released here > ... > > This issue was detected by using the Coccinelle software. Such a detection of a questionable source code place can be nice and helpful. I constructed another script variant for the semantic patch language. @deletion@ expression x; identifier target; @@ of_node_put(x); if (...) goto target; ... when any target: -of_node_put(x); I observe then that this adjustment approach can generate the desired patch for a source code extract. elfring@Sonne:~/Projekte/Coccinelle/Probe> spatch ../janitor/delete_duplicate_of_node_put1.cocci crypto4xx_trng-excerpt1.c … - of_node_put(trng); … But I wonder at the moment why it does not work (as expected) for the original complete source file. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/crypto/amcc/crypto4xx_trng.c?id=5ad18b2e60b75c7297a998dea702451d33a052ed#n71 https://elixir.bootlin.com/linux/v5.2/source/drivers/crypto/amcc/crypto4xx_trng.c#L71 I am curious on further software development ideas. Regards, Markus _______________________________________________ Cocci mailing list Cocci@systeme.lip6.fr https://systeme.lip6.fr/mailman/listinfo/cocci ^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Cocci] Coccinelle: Checking the deletion of duplicate of_node_put() calls with SmPL 2019-07-09 12:14 ` [Cocci] Coccinelle: Checking the deletion of duplicate of_node_put() calls with SmPL Markus Elfring @ 2019-07-10 5:55 ` Markus Elfring 0 siblings, 0 replies; 2+ messages in thread From: Markus Elfring @ 2019-07-10 5:55 UTC (permalink / raw) To: Wen Yang, Julia Lawall, Coccinelle Cc: Yi Wang, Herbert Xu, Greg Kroah-Hartman, LKML, Armijn Hemel, linux-crypto, Xue Zhihong, Cheng Shengyu, Thomas Gleixner, David S. Miller, Allison Randal > But I wonder at the moment why it does not work (as expected) for the original > complete source file. I discovered that a diff hunk (or usable patch?) is generated if the return statement is deleted (or commented out) before the jump label which refers to a potentially unwanted function call at the mentioned place. How will the support evolve for automatic adjustment of such source code combinations by the semantic patch language (Coccinelle software)? Regards, Markus _______________________________________________ Cocci mailing list Cocci@systeme.lip6.fr https://systeme.lip6.fr/mailman/listinfo/cocci ^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-07-10 5:57 UTC | newest] Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <1562566745-7447-2-git-send-email-wen.yang99@zte.com.cn> 2019-07-09 12:14 ` [Cocci] Coccinelle: Checking the deletion of duplicate of_node_put() calls with SmPL Markus Elfring 2019-07-10 5:55 ` 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).