Debian Codegraph @

demos/demo_rule9/rule9_4.cocci

raw
1 @ rule1 @
2 typedef Scsi_Host_Template;
3 {struct SHT, Scsi_Host_Template} fops;
4 identifier proc_info_func;
5 @@
6 fops.proc_info = proc_info_func;
7
8 @ rule2 @
9 identifier rule1.proc_info_func;
10 identifier buffer, start, offset, length, inout, hostno;
11 identifier hostptr;
12 typedef off_t;
13 @@
14 proc_info_func (
15 + struct Scsi_Host *hostptr,
16 char *buffer, char **start, off_t offset, int length,
17 - int hostno,
18 int inout) {
19 ...
20 - struct Scsi_Host *hostptr;
21 ...
22 - hostptr = scsi_host_hn_get(hostno);
23 ...
24 ?- if (!hostptr) { ... return ...; }
25 ...
26 ?- scsi_host_put(hostptr);
27 ...
28 }
29
30 @@
31 identifier rule1.proc_info_func;
32 identifier rule2.hostno;
33 identifier rule2.hostptr;
34 @@
35 proc_info_func(...) {
36 <...
37 - hostno
38 + hostptr->host_no
39 ...>
40 }