diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-11-11 00:11:58 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-11-11 00:11:58 -0500 |
| commit | 5dfe5b2c714a5bea0908c1e00da0e8e00535f55c (patch) | |
| tree | 421470738aac64e438218da770c2775d1041ca01 /scripts | |
| parent | 152813e6e4bbb5f017e33eba7eb01bbda4b389b8 (diff) | |
| parent | 67afc2110a84872aa6aae44ce6b2ea6534db1438 (diff) | |
Merge branch 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild
Pull misc kbuild updates from Michal Marek:
"This is the non-critical part of kbuild:
- several coccinelle updates
- make deb-pkg creates an armhf package if CONFIG_VFP=y
- make tags understands some more powerpc macros"
* 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild:
coccinelle: Improve checking for missing NULL terminators
coccinelle: ifnullfree: handle various destroy functions
coccinelle: ifnullfree: various cleanups
cocinelle: iterators: semantic patch to delete unneeded of_node_put
deb-pkg: Add automatic support for armhf architecture
scripts/coccinelle: fix typos
coccinelle: misc: remove "complex return code" warnings
Coccinelle: fix incorrect -include option transformation
coccinelle: tests: improve odd_ptr_err.cocci
coccinelle: misc: move constants to the right
scripts/tags.sh: Teach tags about some powerpc macros
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/coccicheck | 2 | ||||
| -rw-r--r-- | scripts/coccinelle/free/ifnullfree.cocci | 26 | ||||
| -rw-r--r-- | scripts/coccinelle/iterators/device_node_continue.cocci | 100 | ||||
| -rw-r--r-- | scripts/coccinelle/misc/compare_const_fl.cocci | 171 | ||||
| -rw-r--r-- | scripts/coccinelle/misc/of_table.cocci | 33 | ||||
| -rw-r--r-- | scripts/coccinelle/misc/simple_return.cocci | 180 | ||||
| -rw-r--r-- | scripts/coccinelle/null/deref_null.cocci | 4 | ||||
| -rw-r--r-- | scripts/coccinelle/tests/odd_ptr_err.cocci | 120 | ||||
| -rwxr-xr-x | scripts/package/builddeb | 11 | ||||
| -rwxr-xr-x | scripts/tags.sh | 2 |
10 files changed, 415 insertions, 234 deletions
diff --git a/scripts/coccicheck b/scripts/coccicheck index bbf901afb606..b2d758188f2f 100755 --- a/scripts/coccicheck +++ b/scripts/coccicheck | |||
| @@ -30,7 +30,7 @@ FLAGS="$SPFLAGS --very-quiet" | |||
| 30 | # spatch only allows include directories with the syntax "-I include" | 30 | # spatch only allows include directories with the syntax "-I include" |
| 31 | # while gcc also allows "-Iinclude" and "-include include" | 31 | # while gcc also allows "-Iinclude" and "-include include" |
| 32 | COCCIINCLUDE=${LINUXINCLUDE//-I/-I } | 32 | COCCIINCLUDE=${LINUXINCLUDE//-I/-I } |
| 33 | COCCIINCLUDE=${COCCIINCLUDE//-include/-I} | 33 | COCCIINCLUDE=${COCCIINCLUDE// -include/ --include} |
| 34 | 34 | ||
| 35 | if [ "$C" = "1" -o "$C" = "2" ]; then | 35 | if [ "$C" = "1" -o "$C" = "2" ]; then |
| 36 | ONLINE=1 | 36 | ONLINE=1 |
diff --git a/scripts/coccinelle/free/ifnullfree.cocci b/scripts/coccinelle/free/ifnullfree.cocci index a42d70bf88b3..52bd235286fa 100644 --- a/scripts/coccinelle/free/ifnullfree.cocci +++ b/scripts/coccinelle/free/ifnullfree.cocci | |||
| @@ -16,19 +16,21 @@ virtual context | |||
| 16 | @r2 depends on patch@ | 16 | @r2 depends on patch@ |
| 17 | expression E; | 17 | expression E; |
| 18 | @@ | 18 | @@ |
| 19 | - if (E) | 19 | - if (E != NULL) |
| 20 | ( | 20 | ( |
| 21 | - kfree(E); | 21 | kfree(E); |
| 22 | + kfree(E); | ||
| 23 | | | 22 | | |
| 24 | - debugfs_remove(E); | 23 | debugfs_remove(E); |
| 25 | + debugfs_remove(E); | ||
| 26 | | | 24 | | |
| 27 | - debugfs_remove_recursive(E); | 25 | debugfs_remove_recursive(E); |
| 28 | + debugfs_remove_recursive(E); | ||
| 29 | | | 26 | | |
| 30 | - usb_free_urb(E); | 27 | usb_free_urb(E); |
| 31 | + usb_free_urb(E); | 28 | | |
| 29 | kmem_cache_destroy(E); | ||
| 30 | | | ||
| 31 | mempool_destroy(E); | ||
| 32 | | | ||
| 33 | dma_pool_destroy(E); | ||
| 32 | ) | 34 | ) |
| 33 | 35 | ||
| 34 | @r depends on context || report || org @ | 36 | @r depends on context || report || org @ |
| @@ -36,8 +38,10 @@ expression E; | |||
| 36 | position p; | 38 | position p; |
| 37 | @@ | 39 | @@ |
| 38 | 40 | ||
| 39 | * if (E) | 41 | * if (E != NULL) |
| 40 | * \(kfree@p\|debugfs_remove@p\|debugfs_remove_recursive@p\|usb_free_urb\)(E); | 42 | * \(kfree@p\|debugfs_remove@p\|debugfs_remove_recursive@p\| |
| 43 | * usb_free_urb@p\|kmem_cache_destroy@p\|mempool_destroy@p\| | ||
| 44 | * dma_pool_destroy@p\)(E); | ||
| 41 | 45 | ||
| 42 | @script:python depends on org@ | 46 | @script:python depends on org@ |
| 43 | p << r.p; | 47 | p << r.p; |
diff --git a/scripts/coccinelle/iterators/device_node_continue.cocci b/scripts/coccinelle/iterators/device_node_continue.cocci new file mode 100644 index 000000000000..38ab744a4037 --- /dev/null +++ b/scripts/coccinelle/iterators/device_node_continue.cocci | |||
| @@ -0,0 +1,100 @@ | |||
| 1 | /// Device node iterators put the previous value of the index variable, so an | ||
| 2 | /// explicit put causes a double put. | ||
| 3 | /// | ||
| 4 | // Confidence: High | ||
| 5 | // Copyright: (C) 2015 Julia Lawall, Inria. GPLv2. | ||
| 6 | // URL: http://coccinelle.lip6.fr/ | ||
| 7 | // Options: --no-includes --include-headers | ||
| 8 | // Keywords: for_each_child_of_node, etc. | ||
| 9 | |||
| 10 | virtual patch | ||
| 11 | virtual context | ||
| 12 | virtual org | ||
| 13 | virtual report | ||
| 14 | |||
| 15 | @r exists@ | ||
| 16 | expression e1,e2; | ||
| 17 | local idexpression n; | ||
| 18 | iterator name for_each_node_by_name, for_each_node_by_type, | ||
| 19 | for_each_compatible_node, for_each_matching_node, | ||
| 20 | for_each_matching_node_and_match, for_each_child_of_node, | ||
| 21 | for_each_available_child_of_node, for_each_node_with_property; | ||
| 22 | iterator i; | ||
| 23 | position p1,p2; | ||
| 24 | statement S; | ||
| 25 | @@ | ||
| 26 | |||
| 27 | ( | ||
| 28 | ( | ||
| 29 | for_each_node_by_name(n,e1) S | ||
| 30 | | | ||
| 31 | for_each_node_by_type(n,e1) S | ||
| 32 | | | ||
| 33 | for_each_compatible_node(n,e1,e2) S | ||
| 34 | | | ||
| 35 | for_each_matching_node(n,e1) S | ||
| 36 | | | ||
| 37 | for_each_matching_node_and_match(n,e1,e2) S | ||
| 38 | | | ||
| 39 | for_each_child_of_node(e1,n) S | ||
| 40 | | | ||
| 41 | for_each_available_child_of_node(e1,n) S | ||
| 42 | | | ||
| 43 | for_each_node_with_property(n,e1) S | ||
| 44 | ) | ||
| 45 | & | ||
| 46 | i@p1(...) { | ||
| 47 | ... when != of_node_get(n) | ||
| 48 | when any | ||
| 49 | of_node_put@p2(n); | ||
| 50 | ... when any | ||
| 51 | } | ||
| 52 | ) | ||
| 53 | |||
| 54 | @s exists@ | ||
| 55 | local idexpression r.n; | ||
| 56 | statement S; | ||
| 57 | position r.p1,r.p2; | ||
| 58 | iterator i; | ||
| 59 | @@ | ||
| 60 | |||
| 61 | of_node_put@p2(n); | ||
| 62 | ... when any | ||
| 63 | i@p1(..., n, ...) | ||
| 64 | S | ||
| 65 | |||
| 66 | @t depends on s && patch && !context && !org && !report@ | ||
| 67 | local idexpression n; | ||
| 68 | position r.p2; | ||
| 69 | @@ | ||
| 70 | |||
| 71 | - of_node_put@p2(n); | ||
| 72 | |||
| 73 | // ---------------------------------------------------------------------------- | ||
| 74 | |||
| 75 | @t_context depends on s && !patch && (context || org || report)@ | ||
| 76 | local idexpression n; | ||
| 77 | position r.p2; | ||
| 78 | position j0; | ||
| 79 | @@ | ||
| 80 | |||
| 81 | * of_node_put@j0@p2(n); | ||
| 82 | |||
| 83 | // ---------------------------------------------------------------------------- | ||
| 84 | |||
| 85 | @script:python t_org depends on org@ | ||
| 86 | j0 << t_context.j0; | ||
| 87 | @@ | ||
| 88 | |||
| 89 | msg = "ERROR: probable double put." | ||
| 90 | coccilib.org.print_todo(j0[0], msg) | ||
| 91 | |||
| 92 | // ---------------------------------------------------------------------------- | ||
| 93 | |||
| 94 | @script:python t_report depends on report@ | ||
| 95 | j0 << t_context.j0; | ||
| 96 | @@ | ||
| 97 | |||
| 98 | msg = "ERROR: probable double put." | ||
| 99 | coccilib.report.print_report(j0[0], msg) | ||
| 100 | |||
diff --git a/scripts/coccinelle/misc/compare_const_fl.cocci b/scripts/coccinelle/misc/compare_const_fl.cocci new file mode 100644 index 000000000000..b5d4bab60263 --- /dev/null +++ b/scripts/coccinelle/misc/compare_const_fl.cocci | |||
| @@ -0,0 +1,171 @@ | |||
| 1 | /// Move constants to the right of binary operators. | ||
| 2 | //# Depends on personal taste in some cases. | ||
| 3 | /// | ||
| 4 | // Confidence: Moderate | ||
| 5 | // Copyright: (C) 2015 Copyright: (C) 2015 Julia Lawall, Inria. GPLv2. | ||
| 6 | // URL: http://coccinelle.lip6.fr/ | ||
| 7 | // Options: --no-includes --include-headers | ||
| 8 | |||
| 9 | virtual patch | ||
| 10 | virtual context | ||
| 11 | virtual org | ||
| 12 | virtual report | ||
| 13 | |||
| 14 | @r1 depends on patch && !context && !org && !report | ||
| 15 | disable bitor_comm, neg_if_exp@ | ||
| 16 | constant c,c1; | ||
| 17 | local idexpression i; | ||
| 18 | expression e,e1,e2; | ||
| 19 | binary operator b = {==,!=,&,|}; | ||
| 20 | type t; | ||
| 21 | @@ | ||
| 22 | |||
| 23 | ( | ||
| 24 | c b (c1) | ||
| 25 | | | ||
| 26 | sizeof(t) b e1 | ||
| 27 | | | ||
| 28 | sizeof e b e1 | ||
| 29 | | | ||
| 30 | i b e1 | ||
| 31 | | | ||
| 32 | c | e1 | e2 | ... | ||
| 33 | | | ||
| 34 | c | (e ? e1 : e2) | ||
| 35 | | | ||
| 36 | - c | ||
| 37 | + e | ||
| 38 | b | ||
| 39 | - e | ||
| 40 | + c | ||
| 41 | ) | ||
| 42 | |||
| 43 | @r2 depends on patch && !context && !org && !report | ||
| 44 | disable gtr_lss, gtr_lss_eq, not_int2@ | ||
| 45 | constant c,c1; | ||
| 46 | expression e,e1,e2; | ||
| 47 | binary operator b; | ||
| 48 | binary operator b1 = {<,<=},b2 = {<,<=}; | ||
| 49 | binary operator b3 = {>,>=},b4 = {>,>=}; | ||
| 50 | local idexpression i; | ||
| 51 | type t; | ||
| 52 | @@ | ||
| 53 | |||
| 54 | ( | ||
| 55 | c b c1 | ||
| 56 | | | ||
| 57 | sizeof(t) b e1 | ||
| 58 | | | ||
| 59 | sizeof e b e1 | ||
| 60 | | | ||
| 61 | (e1 b1 e) && (e b2 e2) | ||
| 62 | | | ||
| 63 | (e1 b3 e) && (e b4 e2) | ||
| 64 | | | ||
| 65 | i b e | ||
| 66 | | | ||
| 67 | - c < e | ||
| 68 | + e > c | ||
| 69 | | | ||
| 70 | - c <= e | ||
| 71 | + e >= c | ||
| 72 | | | ||
| 73 | - c > e | ||
| 74 | + e < c | ||
| 75 | | | ||
| 76 | - c >= e | ||
| 77 | + e <= c | ||
| 78 | ) | ||
| 79 | |||
| 80 | // ---------------------------------------------------------------------------- | ||
| 81 | |||
| 82 | @r1_context depends on !patch && (context || org || report) | ||
| 83 | disable bitor_comm, neg_if_exp exists@ | ||
| 84 | type t; | ||
| 85 | binary operator b = {==,!=,&,|}; | ||
| 86 | constant c, c1; | ||
| 87 | expression e, e1, e2; | ||
| 88 | local idexpression i; | ||
| 89 | position j0; | ||
| 90 | @@ | ||
| 91 | |||
| 92 | ( | ||
| 93 | c b (c1) | ||
| 94 | | | ||
| 95 | sizeof(t) b e1 | ||
| 96 | | | ||
| 97 | sizeof e b e1 | ||
| 98 | | | ||
| 99 | i b e1 | ||
| 100 | | | ||
| 101 | c | e1 | e2 | ... | ||
| 102 | | | ||
| 103 | c | (e ? e1 : e2) | ||
| 104 | | | ||
| 105 | * c@j0 b e | ||
| 106 | ) | ||
| 107 | |||
| 108 | @r2_context depends on !patch && (context || org || report) | ||
| 109 | disable gtr_lss, gtr_lss_eq, not_int2 exists@ | ||
| 110 | type t; | ||
| 111 | binary operator b, b1 = {<,<=}, b2 = {<,<=}, b3 = {>,>=}, b4 = {>,>=}; | ||
| 112 | constant c, c1; | ||
| 113 | expression e, e1, e2; | ||
| 114 | local idexpression i; | ||
| 115 | position j0; | ||
| 116 | @@ | ||
| 117 | |||
| 118 | ( | ||
| 119 | c b c1 | ||
| 120 | | | ||
| 121 | sizeof(t) b e1 | ||
| 122 | | | ||
| 123 | sizeof e b e1 | ||
| 124 | | | ||
| 125 | (e1 b1 e) && (e b2 e2) | ||
| 126 | | | ||
| 127 | (e1 b3 e) && (e b4 e2) | ||
| 128 | | | ||
| 129 | i b e | ||
| 130 | | | ||
| 131 | * c@j0 < e | ||
| 132 | | | ||
| 133 | * c@j0 <= e | ||
| 134 | | | ||
| 135 | * c@j0 > e | ||
| 136 | | | ||
| 137 | * c@j0 >= e | ||
| 138 | ) | ||
| 139 | |||
| 140 | // ---------------------------------------------------------------------------- | ||
| 141 | |||
| 142 | @script:python r1_org depends on org@ | ||
| 143 | j0 << r1_context.j0; | ||
| 144 | @@ | ||
| 145 | |||
| 146 | msg = "Move constant to right." | ||
| 147 | coccilib.org.print_todo(j0[0], msg) | ||
| 148 | |||
| 149 | @script:python r2_org depends on org@ | ||
| 150 | j0 << r2_context.j0; | ||
| 151 | @@ | ||
| 152 | |||
| 153 | msg = "Move constant to right." | ||
| 154 | coccilib.org.print_todo(j0[0], msg) | ||
| 155 | |||
| 156 | // ---------------------------------------------------------------------------- | ||
| 157 | |||
| 158 | @script:python r1_report depends on report@ | ||
| 159 | j0 << r1_context.j0; | ||
| 160 | @@ | ||
| 161 | |||
| 162 | msg = "Move constant to right." | ||
| 163 | coccilib.report.print_report(j0[0], msg) | ||
| 164 | |||
| 165 | @script:python r2_report depends on report@ | ||
| 166 | j0 << r2_context.j0; | ||
| 167 | @@ | ||
| 168 | |||
| 169 | msg = "Move constant to right." | ||
| 170 | coccilib.report.print_report(j0[0], msg) | ||
| 171 | |||
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; |
diff --git a/scripts/coccinelle/misc/simple_return.cocci b/scripts/coccinelle/misc/simple_return.cocci deleted file mode 100644 index e8b6313b116f..000000000000 --- a/scripts/coccinelle/misc/simple_return.cocci +++ /dev/null | |||
| @@ -1,180 +0,0 @@ | |||
| 1 | /// Simplify a trivial if-return sequence. Possibly combine with a | ||
| 2 | /// preceding function call. | ||
| 3 | /// | ||
| 4 | // Confidence: High | ||
| 5 | // Copyright: (C) 2014 Julia Lawall, INRIA/LIP6. GPLv2. | ||
| 6 | // Copyright: (C) 2014 Gilles Muller, INRIA/LiP6. GPLv2. | ||
| 7 | // URL: http://coccinelle.lip6.fr/ | ||
| 8 | // Comments: | ||
| 9 | // Options: --no-includes --include-headers | ||
| 10 | |||
| 11 | virtual patch | ||
| 12 | virtual context | ||
| 13 | virtual org | ||
| 14 | virtual report | ||
| 15 | |||
| 16 | @r depends on patch@ | ||
| 17 | local idexpression e; | ||
| 18 | identifier i,f,fn; | ||
| 19 | @@ | ||
| 20 | |||
| 21 | fn(...) { <... | ||
| 22 | - e@i = | ||
| 23 | + return | ||
| 24 | f(...); | ||
| 25 | -if (i != 0) return i; | ||
| 26 | -return 0; | ||
| 27 | ...> } | ||
| 28 | |||
| 29 | @depends on patch@ | ||
| 30 | identifier r.i; | ||
| 31 | type t; | ||
| 32 | @@ | ||
| 33 | |||
| 34 | -t i; | ||
| 35 | ... when != i | ||
| 36 | |||
| 37 | @depends on patch@ | ||
| 38 | expression e; | ||
| 39 | @@ | ||
| 40 | |||
| 41 | -if (e != 0) | ||
| 42 | return e; | ||
| 43 | -return 0; | ||
| 44 | |||
| 45 | // ----------------------------------------------------------------------- | ||
| 46 | |||
| 47 | @s1 depends on context || org || report@ | ||
| 48 | local idexpression e; | ||
| 49 | identifier i,f,fn; | ||
| 50 | position p,p1,p2; | ||
| 51 | @@ | ||
| 52 | |||
| 53 | fn(...) { <... | ||
| 54 | * e@i@p = f(...); | ||
| 55 | if (\(i@p1 != 0\|i@p2 < 0\)) | ||
| 56 | return i; | ||
| 57 | return 0; | ||
| 58 | ...> } | ||
| 59 | |||
| 60 | @s2 depends on context || org || report forall@ | ||
| 61 | identifier s1.i; | ||
| 62 | type t; | ||
| 63 | position q,s1.p; | ||
| 64 | expression e,f; | ||
| 65 | @@ | ||
| 66 | |||
| 67 | * t i@q; | ||
| 68 | ... when != i | ||
| 69 | e@p = f(...); | ||
| 70 | |||
| 71 | @s3 depends on context || org || report@ | ||
| 72 | expression e; | ||
| 73 | position p1!=s1.p1; | ||
| 74 | position p2!=s1.p2; | ||
| 75 | @@ | ||
| 76 | |||
| 77 | *if (\(e@p1 != 0\|e@p2 < 0\)) | ||
| 78 | return e; | ||
| 79 | return 0; | ||
| 80 | |||
| 81 | // ----------------------------------------------------------------------- | ||
| 82 | |||
| 83 | @script:python depends on org@ | ||
| 84 | p << s1.p; | ||
| 85 | p1 << s1.p1; | ||
| 86 | q << s2.q; | ||
| 87 | @@ | ||
| 88 | |||
| 89 | cocci.print_main("decl",q) | ||
| 90 | cocci.print_secs("use",p) | ||
| 91 | cocci.include_match(False) | ||
| 92 | |||
| 93 | @script:python depends on org@ | ||
| 94 | p << s1.p; | ||
| 95 | p2 << s1.p2; | ||
| 96 | q << s2.q; | ||
| 97 | @@ | ||
| 98 | |||
| 99 | cocci.print_main("decl",q) | ||
| 100 | cocci.print_secs("use with questionable test",p) | ||
| 101 | cocci.include_match(False) | ||
| 102 | |||
| 103 | @script:python depends on org@ | ||
| 104 | p << s1.p; | ||
| 105 | p1 << s1.p1; | ||
| 106 | @@ | ||
| 107 | |||
| 108 | cocci.print_main("use",p) | ||
| 109 | |||
| 110 | @script:python depends on org@ | ||
| 111 | p << s1.p; | ||
| 112 | p2 << s1.p2; | ||
| 113 | @@ | ||
| 114 | |||
| 115 | cocci.print_main("use with questionable test",p) | ||
| 116 | |||
| 117 | @script:python depends on org@ | ||
| 118 | p << s3.p1; | ||
| 119 | @@ | ||
| 120 | |||
| 121 | cocci.print_main("test",p) | ||
| 122 | |||
| 123 | @script:python depends on org@ | ||
| 124 | p << s3.p2; | ||
| 125 | @@ | ||
| 126 | |||
| 127 | cocci.print_main("questionable test",p) | ||
| 128 | |||
| 129 | // ----------------------------------------------------------------------- | ||
| 130 | |||
| 131 | @script:python depends on report@ | ||
| 132 | p << s1.p; | ||
| 133 | p1 << s1.p1; | ||
| 134 | q << s2.q; | ||
| 135 | @@ | ||
| 136 | |||
| 137 | msg = "WARNING: end returns can be simpified and declaration on line %s can be dropped" % (q[0].line) | ||
| 138 | coccilib.report.print_report(p[0],msg) | ||
| 139 | cocci.include_match(False) | ||
| 140 | |||
| 141 | @script:python depends on report@ | ||
| 142 | p << s1.p; | ||
| 143 | p1 << s1.p1; | ||
| 144 | q << s2.q | ||
| 145 | ; | ||
| 146 | @@ | ||
| 147 | |||
| 148 | msg = "WARNING: end returns may be simpified if negative or 0 value and declaration on line %s can be dropped" % (q[0].line) | ||
| 149 | coccilib.report.print_report(p[0],msg) | ||
| 150 | cocci.include_match(False) | ||
| 151 | |||
| 152 | @script:python depends on report@ | ||
| 153 | p << s1.p; | ||
| 154 | p1 << s1.p1; | ||
| 155 | @@ | ||
| 156 | |||
| 157 | msg = "WARNING: end returns can be simpified" | ||
| 158 | coccilib.report.print_report(p[0],msg) | ||
| 159 | |||
| 160 | @script:python depends on report@ | ||
| 161 | p << s1.p; | ||
| 162 | p2 << s1.p2; | ||
| 163 | @@ | ||
| 164 | |||
| 165 | msg = "WARNING: end returns can be simpified if negative or 0 value" | ||
| 166 | coccilib.report.print_report(p[0],msg) | ||
| 167 | |||
| 168 | @script:python depends on report@ | ||
| 169 | p << s3.p1; | ||
| 170 | @@ | ||
| 171 | |||
| 172 | msg = "WARNING: end returns can be simpified" | ||
| 173 | coccilib.report.print_report(p[0],msg) | ||
| 174 | |||
| 175 | @script:python depends on report@ | ||
| 176 | p << s3.p2; | ||
| 177 | @@ | ||
| 178 | |||
| 179 | msg = "WARNING: end returns can be simpified if tested value is negative or 0" | ||
| 180 | coccilib.report.print_report(p[0],msg) | ||
diff --git a/scripts/coccinelle/null/deref_null.cocci b/scripts/coccinelle/null/deref_null.cocci index cdac6cfcce92..f192d6035d02 100644 --- a/scripts/coccinelle/null/deref_null.cocci +++ b/scripts/coccinelle/null/deref_null.cocci | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /// | 1 | /// |
| 2 | /// A variable is dereference under a NULL test. | 2 | /// A variable is dereferenced under a NULL test. |
| 3 | /// Even though it is know to be NULL. | 3 | /// Even though it is known to be NULL. |
| 4 | /// | 4 | /// |
| 5 | // Confidence: Moderate | 5 | // Confidence: Moderate |
| 6 | // Copyright: (C) 2010 Nicolas Palix, DIKU. GPLv2. | 6 | // Copyright: (C) 2010 Nicolas Palix, DIKU. GPLv2. |
diff --git a/scripts/coccinelle/tests/odd_ptr_err.cocci b/scripts/coccinelle/tests/odd_ptr_err.cocci index cfe0a35cf2dd..dfc6b40c2969 100644 --- a/scripts/coccinelle/tests/odd_ptr_err.cocci +++ b/scripts/coccinelle/tests/odd_ptr_err.cocci | |||
| @@ -1,12 +1,11 @@ | |||
| 1 | /// PTR_ERR should access the value just tested by IS_ERR | 1 | /// PTR_ERR should access the value just tested by IS_ERR |
| 2 | //# There can be false positives in the patch case, where it is the call | 2 | //# There can be false positives in the patch case, where it is the call to |
| 3 | //# IS_ERR that is wrong. | 3 | //# IS_ERR that is wrong. |
| 4 | /// | 4 | /// |
| 5 | // Confidence: High | 5 | // Confidence: High |
| 6 | // Copyright: (C) 2012 Julia Lawall, INRIA. GPLv2. | 6 | // Copyright: (C) 2012, 2015 Julia Lawall, INRIA. GPLv2. |
| 7 | // Copyright: (C) 2012 Gilles Muller, INRIA. GPLv2. | 7 | // Copyright: (C) 2012, 2015 Gilles Muller, INRIA. GPLv2. |
| 8 | // URL: http://coccinelle.lip6.fr/ | 8 | // URL: http://coccinelle.lip6.fr/ |
| 9 | // Comments: | ||
| 10 | // Options: --no-includes --include-headers | 9 | // Options: --no-includes --include-headers |
| 11 | 10 | ||
| 12 | virtual patch | 11 | virtual patch |
| @@ -14,52 +13,105 @@ virtual context | |||
| 14 | virtual org | 13 | virtual org |
| 15 | virtual report | 14 | virtual report |
| 16 | 15 | ||
| 17 | @depends on patch@ | 16 | @ok1 exists@ |
| 18 | expression e,e1; | 17 | expression x,e; |
| 18 | position p; | ||
| 19 | @@ | 19 | @@ |
| 20 | 20 | ||
| 21 | if (IS_ERR(x=e) || ...) { | ||
| 22 | <... | ||
| 23 | PTR_ERR@p(x) | ||
| 24 | ...> | ||
| 25 | } | ||
| 26 | |||
| 27 | @ok2 exists@ | ||
| 28 | expression x,e1,e2; | ||
| 29 | position p; | ||
| 30 | @@ | ||
| 31 | |||
| 32 | if (IS_ERR(x) || ...) { | ||
| 33 | <... | ||
| 21 | ( | 34 | ( |
| 22 | if (IS_ERR(e)) { ... PTR_ERR(e) ... } | 35 | PTR_ERR@p(\(e1 ? e2 : x\|e1 ? x : e2\)) |
| 23 | | | 36 | | |
| 24 | if (IS_ERR(e=e1)) { ... PTR_ERR(e) ... } | 37 | PTR_ERR@p(x) |
| 38 | ) | ||
| 39 | ...> | ||
| 40 | } | ||
| 41 | |||
| 42 | @r1 depends on patch && !context && !org && !report exists@ | ||
| 43 | expression x,y; | ||
| 44 | position p != {ok1.p,ok2.p}; | ||
| 45 | @@ | ||
| 46 | |||
| 47 | if (IS_ERR(x) || ...) { | ||
| 48 | ... when any | ||
| 49 | when != IS_ERR(...) | ||
| 50 | ( | ||
| 51 | PTR_ERR(x) | ||
| 25 | | | 52 | | |
| 26 | if (IS_ERR(e)) | 53 | PTR_ERR@p( |
| 27 | { ... | 54 | - y |
| 28 | PTR_ERR( | 55 | + x |
| 29 | - e1 | ||
| 30 | + e | ||
| 31 | ) | 56 | ) |
| 32 | ... } | ||
| 33 | ) | 57 | ) |
| 58 | ... when any | ||
| 59 | } | ||
| 60 | |||
| 61 | // ---------------------------------------------------------------------------- | ||
| 34 | 62 | ||
| 35 | @r depends on !patch@ | 63 | @r1_context depends on !patch && (context || org || report) exists@ |
| 36 | expression e,e1; | 64 | position p != {ok1.p,ok2.p}; |
| 37 | position p1,p2; | 65 | expression x, y; |
| 66 | position j0, j1; | ||
| 38 | @@ | 67 | @@ |
| 39 | 68 | ||
| 69 | if (IS_ERR@j0(x) || ...) { | ||
| 70 | ... when any | ||
| 71 | when != IS_ERR(...) | ||
| 40 | ( | 72 | ( |
| 41 | if (IS_ERR(e)) { ... PTR_ERR(e) ... } | 73 | PTR_ERR(x) |
| 42 | | | 74 | | |
| 43 | if (IS_ERR(e=e1)) { ... PTR_ERR(e) ... } | 75 | PTR_ERR@j1@p( |
| 44 | | | 76 | y |
| 45 | *if (IS_ERR@p1(e)) | 77 | ) |
| 46 | { ... | ||
| 47 | * PTR_ERR@p2(e1) | ||
| 48 | ... } | ||
| 49 | ) | 78 | ) |
| 79 | ... when any | ||
| 80 | } | ||
| 50 | 81 | ||
| 51 | @script:python depends on org@ | 82 | @r1_disj depends on !patch && (context || org || report) exists@ |
| 52 | p1 << r.p1; | 83 | position p != {ok1.p,ok2.p}; |
| 53 | p2 << r.p2; | 84 | expression x, y; |
| 85 | position r1_context.j0, r1_context.j1; | ||
| 54 | @@ | 86 | @@ |
| 55 | 87 | ||
| 56 | cocci.print_main("inconsistent IS_ERR and PTR_ERR",p1) | 88 | * if (IS_ERR@j0(x) || ...) { |
| 57 | cocci.print_secs("PTR_ERR",p2) | 89 | ... when any |
| 90 | when != IS_ERR(...) | ||
| 91 | * PTR_ERR@j1@p( | ||
| 92 | y | ||
| 93 | ) | ||
| 94 | ... when any | ||
| 95 | } | ||
| 58 | 96 | ||
| 59 | @script:python depends on report@ | 97 | // ---------------------------------------------------------------------------- |
| 60 | p1 << r.p1; | 98 | |
| 61 | p2 << r.p2; | 99 | @script:python r1_org depends on org@ |
| 100 | j0 << r1_context.j0; | ||
| 101 | j1 << r1_context.j1; | ||
| 62 | @@ | 102 | @@ |
| 63 | 103 | ||
| 64 | msg = "inconsistent IS_ERR and PTR_ERR, PTR_ERR on line %s" % (p2[0].line) | 104 | msg = "inconsistent IS_ERR and PTR_ERR" |
| 65 | coccilib.report.print_report(p1[0],msg) | 105 | coccilib.org.print_todo(j0[0], msg) |
| 106 | coccilib.org.print_link(j1[0], "") | ||
| 107 | |||
| 108 | // ---------------------------------------------------------------------------- | ||
| 109 | |||
| 110 | @script:python r1_report depends on report@ | ||
| 111 | j0 << r1_context.j0; | ||
| 112 | j1 << r1_context.j1; | ||
| 113 | @@ | ||
| 114 | |||
| 115 | msg = "inconsistent IS_ERR and PTR_ERR on line %s." % (j1[0].line) | ||
| 116 | coccilib.report.print_report(j0[0], msg) | ||
| 117 | |||
diff --git a/scripts/package/builddeb b/scripts/package/builddeb index b967e4f9fed2..6c3b038ef40d 100755 --- a/scripts/package/builddeb +++ b/scripts/package/builddeb | |||
| @@ -52,7 +52,16 @@ set_debarch() { | |||
| 52 | arm64) | 52 | arm64) |
| 53 | debarch=arm64 ;; | 53 | debarch=arm64 ;; |
| 54 | arm*) | 54 | arm*) |
| 55 | debarch=arm$(grep -q CONFIG_AEABI=y $KCONFIG_CONFIG && echo el || true) ;; | 55 | if grep -q CONFIG_AEABI=y $KCONFIG_CONFIG; then |
| 56 | if grep -q CONFIG_VFP=y $KCONFIG_CONFIG; then | ||
| 57 | debarch=armhf | ||
| 58 | else | ||
| 59 | debarch=armel | ||
| 60 | fi | ||
| 61 | else | ||
| 62 | debarch=arm | ||
| 63 | fi | ||
| 64 | ;; | ||
| 56 | *) | 65 | *) |
| 57 | debarch=$(dpkg --print-architecture) | 66 | debarch=$(dpkg --print-architecture) |
| 58 | echo "" >&2 | 67 | echo "" >&2 |
diff --git a/scripts/tags.sh b/scripts/tags.sh index 8e5aee6d9da2..262889046703 100755 --- a/scripts/tags.sh +++ b/scripts/tags.sh | |||
| @@ -198,6 +198,8 @@ exuberant() | |||
| 198 | --regex-c++='/TASK_PFA_TEST\([^,]*,\s*([^)]*)\)/task_\1/' \ | 198 | --regex-c++='/TASK_PFA_TEST\([^,]*,\s*([^)]*)\)/task_\1/' \ |
| 199 | --regex-c++='/TASK_PFA_SET\([^,]*,\s*([^)]*)\)/task_set_\1/' \ | 199 | --regex-c++='/TASK_PFA_SET\([^,]*,\s*([^)]*)\)/task_set_\1/' \ |
| 200 | --regex-c++='/TASK_PFA_CLEAR\([^,]*,\s*([^)]*)\)/task_clear_\1/'\ | 200 | --regex-c++='/TASK_PFA_CLEAR\([^,]*,\s*([^)]*)\)/task_clear_\1/'\ |
| 201 | --regex-c++='/DEF_MMIO_(IN|OUT)_(X|D)\(([^,]*),\s*[^)]*\)/\3/' \ | ||
| 202 | --regex-c++='/DEBUGGER_BOILERPLATE\(([^,]*)\)/\1/' \ | ||
| 201 | --regex-c='/PCI_OP_READ\((\w*).*[1-4]\)/pci_bus_read_config_\1/' \ | 203 | --regex-c='/PCI_OP_READ\((\w*).*[1-4]\)/pci_bus_read_config_\1/' \ |
| 202 | --regex-c='/PCI_OP_WRITE\((\w*).*[1-4]\)/pci_bus_write_config_\1/' \ | 204 | --regex-c='/PCI_OP_WRITE\((\w*).*[1-4]\)/pci_bus_write_config_\1/' \ |
| 203 | --regex-c='/DEFINE_(MUTEX|SEMAPHORE|SPINLOCK)\((\w*)/\2/v/' \ | 205 | --regex-c='/DEFINE_(MUTEX|SEMAPHORE|SPINLOCK)\((\w*)/\2/v/' \ |
