1 /// Find functions that refer to GFP_KERNEL but are called with locks held.
2 //# The proposed change of converting the GFP_KERNEL is not necessarily the
3 //# correct one. It may be desired to unlock the lock, or to not call the
4 //# function under the lock in the first place.
6 // Confidence: Moderate
7 // Copyright: (C) 2012 Nicolas Palix. GPLv2.
8 // Copyright: (C) 2012 Julia Lawall, INRIA/LIP6. GPLv2.
9 // Copyright: (C) 2012 Gilles Muller, INRIA/LiP6. GPLv2.
10 // URL: http://coccinelle.lip6.fr/
12 // Options: --no-includes --include-headers
25 ... when != read_unlock_irq(...)
26 when != write_unlock_irq(...)
27 when != read_unlock_irqrestore(...)
28 when != write_unlock_irqrestore(...)
29 when != spin_unlock(...)
30 when != spin_unlock_irq(...)
31 when != spin_unlock_irqrestore(...)
32 when != local_irq_enable(...)
63 ... when != read_unlock_irq(...)
64 when != write_unlock_irq(...)
65 when != read_unlock_irqrestore(...)
66 when != write_unlock_irqrestore(...)
67 when != spin_unlock(...)
68 when != spin_unlock_irq(...)
69 when != spin_unlock_irqrestore(...)
70 when != local_irq_enable(...)
73 @depends on locked && patch@
80 @depends on locked && !patch@
86 @script:python depends on !patch && org@
93 cocci.print_main("lock",p1)
94 cocci.print_secs("call",p2)
95 cocci.print_secs("GFP_KERNEL",p)
97 @script:python depends on !patch && report@
104 msg = "ERROR: function %s called on line %s inside lock on line %s but uses GFP_KERNEL" % (fn,p2[0].line,p1[0].line)
105 coccilib.report.print_report(p[0], msg)