/
pciom3.cocci
62 lines (56 loc) · 944 Bytes
/
pciom3.cocci
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
//
// Exchange pci_iounmaps
//
// Target: Linux
// Copyright: 2012 - LIP6/INRIA
// License: Licensed under ISC. See LICENSE or http://www.isc.org/software/license
// Author: Julia Lawall <Julia.Lawall@lip6.fr>
// URL: http://coccinelle.lip6.fr/
// URL: http://coccinellery.org/
@r exists@
expression e,x;
statement S,S1;
int ret;
position p;
@@
e = pci_iomap(x,...)
... when != pci_iounmap(x,e)
if (<+...e...+>) S
... when any
when != pci_iounmap(x,e)
when != if (...) { ... pci_iounmap(x,e); ... }
(
if (ret == 0) S1
|
if (...)
{ ...
return 0; }
|
if (...)
{ ...
return <+...e...+>; }
|
if@p (...)
{ ... when != pci_iounmap(x,e)
when forall
return ...; }
)
... when any
pci_iounmap(x,e);
@ok@
position r.p;
statement S;
identifier l;
@@
(
if@p(...) { ... when != if(...) S
}
|
if@p(...) return ...;
|
if@p(...) goto l;
)
@script:python depends on ok@
p<<r.p;
@@
cocci.print_main("ret",p)