diff options
author | Daniel Granat <d.granat@samsung.com> | 2015-10-23 11:31:06 -0400 |
---|---|---|
committer | Michal Marek <mmarek@suse.com> | 2015-10-26 17:44:51 -0400 |
commit | 67afc2110a84872aa6aae44ce6b2ea6534db1438 (patch) | |
tree | cbc47493c14830f1b243c8dea7ffc0e9390fdac1 /scripts | |
parent | 4743775c6de44b3c36e15bcab2dee928b6361a16 (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.cocci | 33 |
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 | |||
13 | identifier var, arr; | 13 | identifier var, arr; |
14 | expression E; | 14 | expression E; |
15 | @@ | 15 | @@ |
16 | struct of_device_id arr[] = { | 16 | ( |
17 | struct \(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 | | | ||
24 | struct \(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@ |
24 | identifier var, arr; | 31 | identifier var, arr; |
25 | expression E; | 32 | expression E; |
26 | @@ | 33 | @@ |
27 | struct of_device_id arr[] = { | 34 | ( |
35 | struct \(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 | | | ||
44 | struct \(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@ |
37 | position p1; | 52 | position p1; |
38 | identifier var, arr; | 53 | identifier var, arr; |
39 | expression E; | 54 | expression E; |
40 | @@ | 55 | @@ |
41 | struct of_device_id arr[] = { | 56 | ( |
57 | struct \(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 | | | ||
65 | struct \(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@ |
50 | p1 << r.p1; | 73 | p1 << r.p1; |