lkml.org 
[lkml]   [2019]   [Jul]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: Coccinelle: Checking the deletion of duplicate of_node_put() calls with SmPL
From
Date
> 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

\
 
 \ /
  Last update: 2019-07-09 14:17    [W:0.107 / U:13.768 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site