| /// Find missing unlocks. This semantic match considers the specific case |
| /// where the unlock is missing from an if branch, and there is a lock |
| /// before the if and an unlock after the if. False positives are due to |
| /// cases where the if branch represents a case where the function is |
| /// supposed to exit with the lock held, or where there is some preceding |
| /// function call that releases the lock. |
| // Copyright: (C) 2010-2012 Nicolas Palix. GPLv2. |
| // Copyright: (C) 2010-2012 Julia Lawall, INRIA/LIP6. GPLv2. |
| // Copyright: (C) 2010-2012 Gilles Muller, INRIA/LiP6. GPLv2. |
| // URL: http://coccinelle.lip6.fr/ |
| // Options: --no-includes --include-headers |
| for(...;...;...) { <+... return@r ...; ...+> } |
| position up != prelocked.p1; |
| @script:python depends on org@ |
| cocci.print_secs(unlock,p2) |
| @script:python depends on report@ |
| msg = "preceding lock on line %s" % (p[0].line) |
| coccilib.report.print_report(p2[0],msg) |