summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorDaniel Granat <d.granat@samsung.com>2015-10-23 11:31:06 -0400
committerMichal Marek <mmarek@suse.com>2015-10-26 17:44:51 -0400
commit67afc2110a84872aa6aae44ce6b2ea6534db1438 (patch)
treecbc47493c14830f1b243c8dea7ffc0e9390fdac1 /scripts
parent4743775c6de44b3c36e15bcab2dee928b6361a16 (diff)
coccinelle: Improve checking for missing NULL terminators
Extend checking on tables containing structures which are initialized without specifying member name. Added new tables for checking: i2c_device_id and platform_device_id. Signed-off-by: Daniel Granat <d.granat@samsung.com> Acked-by: Julia Lawall <julia.lawall@lip6.fr> Signed-off-by: Michal Marek <mmarek@suse.cz>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/coccinelle/misc/of_table.cocci33
1 files changed, 28 insertions, 5 deletions
diff --git a/scripts/coccinelle/misc/of_table.cocci b/scripts/coccinelle/misc/of_table.cocci
index 3c934046a060..2294915a19bc 100644
--- a/scripts/coccinelle/misc/of_table.cocci
+++ b/scripts/coccinelle/misc/of_table.cocci
@@ -1,6 +1,6 @@
1/// Make sure of_device_id tables are NULL terminated 1/// Make sure (of/i2c/platform)_device_id tables are NULL terminated
2// 2//
3// Keywords: of_table 3// Keywords: of_table i2c_table platform_table
4// Confidence: Medium 4// Confidence: Medium
5// Options: --include-headers 5// Options: --include-headers
6 6
@@ -13,18 +13,26 @@ virtual report
13identifier var, arr; 13identifier var, arr;
14expression E; 14expression E;
15@@ 15@@
16struct of_device_id arr[] = { 16(
17struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
17 ..., 18 ...,
18 { 19 {
19 .var = E, 20 .var = E,
20* } 21* }
21}; 22};
23|
24struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
25 ...,
26* { ..., E, ... },
27};
28)
22 29
23@depends on patch@ 30@depends on patch@
24identifier var, arr; 31identifier var, arr;
25expression E; 32expression E;
26@@ 33@@
27struct of_device_id arr[] = { 34(
35struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
28 ..., 36 ...,
29 { 37 {
30 .var = E, 38 .var = E,
@@ -32,19 +40,34 @@ struct of_device_id arr[] = {
32+ }, 40+ },
33+ { } 41+ { }
34}; 42};
43|
44struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
45 ...,
46 { ..., E, ... },
47+ { },
48};
49)
35 50
36@r depends on org || report@ 51@r depends on org || report@
37position p1; 52position p1;
38identifier var, arr; 53identifier var, arr;
39expression E; 54expression E;
40@@ 55@@
41struct of_device_id arr[] = { 56(
57struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
42 ..., 58 ...,
43 { 59 {
44 .var = E, 60 .var = E,
45 } 61 }
46 @p1 62 @p1
47}; 63};
64|
65struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
66 ...,
67 { ..., E, ... }
68 @p1
69};
70)
48 71
49@script:python depends on org@ 72@script:python depends on org@
50p1 << r.p1; 73p1 << r.p1;