Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) // SPDX-License-Identifier: GPL-2.0-only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) /// Find double locks.  False positives may occur when some paths cannot
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3) /// occur at execution, due to the values of variables, and when there is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4) /// an intervening function call that releases the lock.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5) ///
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6) // Confidence: Moderate
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) // Copyright: (C) 2010 Nicolas Palix, DIKU.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) // Copyright: (C) 2010 Julia Lawall, DIKU.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) // Copyright: (C) 2010 Gilles Muller, INRIA/LiP6.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) // URL: http://coccinelle.lip6.fr/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) // Comments:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) // Options: --no-includes --include-headers
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) virtual org
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) virtual report
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) @locked@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) position p1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) expression E1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) position p;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) @@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) (
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) mutex_lock@p1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) mutex_trylock@p1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) spin_lock@p1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) spin_trylock@p1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) read_lock@p1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) read_trylock@p1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) write_lock@p1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) write_trylock@p1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) ) (E1@p,...);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) @balanced@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) position p1 != locked.p1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) position locked.p;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) identifier lock,unlock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) expression x <= locked.E1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) expression E,locked.E1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) expression E2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) @@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) if (E) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51)  <+... when != E1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52)  lock(E1@p,...)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53)  ...+>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) ... when != E1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56)     when != \(x = E2\|&x\)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57)     when forall
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) if (E) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59)  <+... when != E1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60)  unlock@p1(E1,...)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61)  ...+>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) @r depends on !balanced exists@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) expression x <= locked.E1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) expression locked.E1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) expression E2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) identifier lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) position locked.p,p1,p2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) @@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) lock@p1 (E1@p,...);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) ... when != E1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74)     when != \(x = E2\|&x\)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) lock@p2 (E1,...);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) @script:python depends on org@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) p1 << r.p1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) p2 << r.p2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) lock << r.lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) @@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) cocci.print_main(lock,p1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) cocci.print_secs("second lock",p2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) @script:python depends on report@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) p1 << r.p1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) p2 << r.p2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) lock << r.lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) @@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) msg = "second lock on line %s" % (p2[0].line)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) coccilib.report.print_report(p1[0],msg)