1 // SPDX-License-Identifier: GPL-2.0-only
2 /// Find double locks. False positives may occur when some paths cannot
3 /// occur at execution, due to the values of variables, and when there is
4 /// an intervening function call that releases the lock.
6 // Confidence: Moderate
7 // Copyright: (C) 2010 Nicolas Palix, DIKU.
8 // Copyright: (C) 2010 Julia Lawall, DIKU.
9 // Copyright: (C) 2010 Gilles Muller, INRIA/LiP6.
10 // URL: http://coccinelle.lip6.fr/
12 // Options: --no-includes --include-headers
42 position p1 != locked.p1;
44 identifier lock,unlock;
45 expression x <= locked.E1;
46 expression E,locked.E1;
56 when != \(x = E2\|&x\)
64 @r depends on !balanced exists@
65 expression x <= locked.E1;
69 position locked.p,p1,p2;
74 when != \(x = E2\|&x\)
77 @script:python depends on org@
83 cocci.print_main(lock,p1)
84 cocci.print_secs("second lock",p2)
86 @script:python depends on report@
92 msg = "second lock on line %s" % (p2[0].line)
93 coccilib.report.print_report(p1[0],msg)