diff options
| -rw-r--r-- | scripts/coccinelle/api/ptr_ret.cocci | 70 | ||||
| -rw-r--r-- | scripts/coccinelle/free/clk_put.cocci | 67 | ||||
| -rw-r--r-- | scripts/coccinelle/free/iounmap.cocci | 67 | ||||
| -rw-r--r-- | scripts/coccinelle/misc/boolinit.cocci | 178 | ||||
| -rw-r--r-- | scripts/coccinelle/misc/cstptr.cocci | 41 | ||||
| -rw-r--r-- | scripts/coccinelle/null/badzero.cocci | 237 | ||||
| -rw-r--r-- | scripts/package/builddeb | 20 | ||||
| -rwxr-xr-x | scripts/patch-kernel | 4 | ||||
| -rwxr-xr-x | scripts/tags.sh | 13 |
9 files changed, 687 insertions, 10 deletions
diff --git a/scripts/coccinelle/api/ptr_ret.cocci b/scripts/coccinelle/api/ptr_ret.cocci new file mode 100644 index 000000000000..cbfd08c7d8c7 --- /dev/null +++ b/scripts/coccinelle/api/ptr_ret.cocci | |||
| @@ -0,0 +1,70 @@ | |||
| 1 | /// | ||
| 2 | /// Use PTR_RET rather than if(IS_ERR(...)) + PTR_ERR | ||
| 3 | /// | ||
| 4 | // Confidence: High | ||
| 5 | // Copyright: (C) 2012 Julia Lawall, INRIA/LIP6. GPLv2. | ||
| 6 | // Copyright: (C) 2012 Gilles Muller, INRIA/LiP6. GPLv2. | ||
| 7 | // URL: http://coccinelle.lip6.fr/ | ||
| 8 | // Options: -no_includes -include_headers | ||
| 9 | // | ||
| 10 | // Keywords: ERR_PTR, PTR_ERR, PTR_RET | ||
| 11 | // Version min: 2.6.39 | ||
| 12 | // | ||
| 13 | |||
| 14 | virtual context | ||
| 15 | virtual patch | ||
| 16 | virtual org | ||
| 17 | virtual report | ||
| 18 | |||
| 19 | @depends on patch@ | ||
| 20 | expression ptr; | ||
| 21 | @@ | ||
| 22 | |||
| 23 | - if (IS_ERR(ptr)) return PTR_ERR(ptr); else return 0; | ||
| 24 | + return PTR_RET(ptr); | ||
| 25 | |||
| 26 | @depends on patch@ | ||
| 27 | expression ptr; | ||
| 28 | @@ | ||
| 29 | |||
| 30 | - if (IS_ERR(ptr)) return PTR_ERR(ptr); return 0; | ||
| 31 | + return PTR_RET(ptr); | ||
| 32 | |||
| 33 | @r1 depends on !patch@ | ||
| 34 | expression ptr; | ||
| 35 | position p1; | ||
| 36 | @@ | ||
| 37 | |||
| 38 | * if@p1 (IS_ERR(ptr)) return PTR_ERR(ptr); else return 0; | ||
| 39 | |||
| 40 | @r2 depends on !patch@ | ||
| 41 | expression ptr; | ||
| 42 | position p2; | ||
| 43 | @@ | ||
| 44 | |||
| 45 | * if@p2 (IS_ERR(ptr)) return PTR_ERR(ptr); return 0; | ||
| 46 | |||
| 47 | @script:python depends on org@ | ||
| 48 | p << r1.p1; | ||
| 49 | @@ | ||
| 50 | |||
| 51 | coccilib.org.print_todo(p[0], "WARNING: PTR_RET can be used") | ||
| 52 | |||
| 53 | |||
| 54 | @script:python depends on org@ | ||
| 55 | p << r2.p2; | ||
| 56 | @@ | ||
| 57 | |||
| 58 | coccilib.org.print_todo(p[0], "WARNING: PTR_RET can be used") | ||
| 59 | |||
| 60 | @script:python depends on report@ | ||
| 61 | p << r1.p1; | ||
| 62 | @@ | ||
| 63 | |||
| 64 | coccilib.report.print_report(p[0], "WARNING: PTR_RET can be used") | ||
| 65 | |||
| 66 | @script:python depends on report@ | ||
| 67 | p << r2.p2; | ||
| 68 | @@ | ||
| 69 | |||
| 70 | coccilib.report.print_report(p[0], "WARNING: PTR_RET can be used") | ||
diff --git a/scripts/coccinelle/free/clk_put.cocci b/scripts/coccinelle/free/clk_put.cocci new file mode 100644 index 000000000000..46747adfd20a --- /dev/null +++ b/scripts/coccinelle/free/clk_put.cocci | |||
| @@ -0,0 +1,67 @@ | |||
| 1 | /// Find missing clk_puts. | ||
| 2 | /// | ||
| 3 | //# This only signals a missing clk_put when there is a clk_put later | ||
| 4 | //# in the same function. | ||
| 5 | //# False positives can be due to loops. | ||
| 6 | // | ||
| 7 | // Confidence: Moderate | ||
| 8 | // Copyright: (C) 2012 Julia Lawall, INRIA/LIP6. GPLv2. | ||
| 9 | // Copyright: (C) 2012 Gilles Muller, INRIA/LiP6. GPLv2. | ||
| 10 | // URL: http://coccinelle.lip6.fr/ | ||
| 11 | // Comments: | ||
| 12 | // Options: | ||
| 13 | |||
| 14 | virtual context | ||
| 15 | virtual org | ||
| 16 | virtual report | ||
| 17 | |||
| 18 | @clk@ | ||
| 19 | expression e; | ||
| 20 | statement S,S1; | ||
| 21 | int ret; | ||
| 22 | position p1,p2,p3; | ||
| 23 | @@ | ||
| 24 | |||
| 25 | e = clk_get@p1(...) | ||
| 26 | ... when != clk_put(e) | ||
| 27 | if (<+...e...+>) S | ||
| 28 | ... when any | ||
| 29 | when != clk_put(e) | ||
| 30 | when != if (...) { ... clk_put(e); ... } | ||
| 31 | ( | ||
| 32 | if (ret == 0) S1 | ||
| 33 | | | ||
| 34 | if (...) | ||
| 35 | { ... | ||
| 36 | return 0; } | ||
| 37 | | | ||
| 38 | if (...) | ||
| 39 | { ... | ||
| 40 | return <+...e...+>; } | ||
| 41 | | | ||
| 42 | *if@p2 (...) | ||
| 43 | { ... when != clk_put(e) | ||
| 44 | when forall | ||
| 45 | return@p3 ...; } | ||
| 46 | ) | ||
| 47 | ... when any | ||
| 48 | clk_put(e); | ||
| 49 | |||
| 50 | @script:python depends on org@ | ||
| 51 | p1 << clk.p1; | ||
| 52 | p2 << clk.p2; | ||
| 53 | p3 << clk.p3; | ||
| 54 | @@ | ||
| 55 | |||
| 56 | cocci.print_main("clk_get",p1) | ||
| 57 | cocci.print_secs("if",p2) | ||
| 58 | cocci.print_secs("needed clk_put",p3) | ||
| 59 | |||
| 60 | @script:python depends on report@ | ||
| 61 | p1 << clk.p1; | ||
| 62 | p2 << clk.p2; | ||
| 63 | p3 << clk.p3; | ||
| 64 | @@ | ||
| 65 | |||
| 66 | msg = "ERROR: missing clk_put; clk_get on line %s and execution via conditional on line %s" % (p1[0].line,p2[0].line) | ||
| 67 | coccilib.report.print_report(p3[0],msg) | ||
diff --git a/scripts/coccinelle/free/iounmap.cocci b/scripts/coccinelle/free/iounmap.cocci new file mode 100644 index 000000000000..5384f4ba1192 --- /dev/null +++ b/scripts/coccinelle/free/iounmap.cocci | |||
| @@ -0,0 +1,67 @@ | |||
| 1 | /// Find missing iounmaps. | ||
| 2 | /// | ||
| 3 | //# This only signals a missing iounmap when there is an iounmap later | ||
| 4 | //# in the same function. | ||
| 5 | //# False positives can be due to loops. | ||
| 6 | // | ||
| 7 | // Confidence: Moderate | ||
| 8 | // Copyright: (C) 2012 Julia Lawall, INRIA/LIP6. GPLv2. | ||
| 9 | // Copyright: (C) 2012 Gilles Muller, INRIA/LiP6. GPLv2. | ||
| 10 | // URL: http://coccinelle.lip6.fr/ | ||
| 11 | // Comments: | ||
| 12 | // Options: | ||
| 13 | |||
| 14 | virtual context | ||
| 15 | virtual org | ||
| 16 | virtual report | ||
| 17 | |||
| 18 | @iom@ | ||
| 19 | expression e; | ||
| 20 | statement S,S1; | ||
| 21 | int ret; | ||
| 22 | position p1,p2,p3; | ||
| 23 | @@ | ||
| 24 | |||
| 25 | e = \(ioremap@p1\|ioremap_nocache@p1\)(...) | ||
| 26 | ... when != iounmap(e) | ||
| 27 | if (<+...e...+>) S | ||
| 28 | ... when any | ||
| 29 | when != iounmap(e) | ||
| 30 | when != if (...) { ... iounmap(e); ... } | ||
| 31 | ( | ||
| 32 | if (ret == 0) S1 | ||
| 33 | | | ||
| 34 | if (...) | ||
| 35 | { ... | ||
| 36 | return 0; } | ||
| 37 | | | ||
| 38 | if (...) | ||
| 39 | { ... | ||
| 40 | return <+...e...+>; } | ||
| 41 | | | ||
| 42 | *if@p2 (...) | ||
| 43 | { ... when != iounmap(e) | ||
| 44 | when forall | ||
| 45 | return@p3 ...; } | ||
| 46 | ) | ||
| 47 | ... when any | ||
| 48 | iounmap(e); | ||
| 49 | |||
| 50 | @script:python depends on org@ | ||
| 51 | p1 << iom.p1; | ||
| 52 | p2 << iom.p2; | ||
| 53 | p3 << iom.p3; | ||
| 54 | @@ | ||
| 55 | |||
| 56 | cocci.print_main("ioremap",p1) | ||
| 57 | cocci.print_secs("if",p2) | ||
| 58 | cocci.print_secs("needed iounmap",p3) | ||
| 59 | |||
| 60 | @script:python depends on report@ | ||
| 61 | p1 << iom.p1; | ||
| 62 | p2 << iom.p2; | ||
| 63 | p3 << iom.p3; | ||
| 64 | @@ | ||
| 65 | |||
| 66 | msg = "ERROR: missing iounmap; ioremap on line %s and execution via conditional on line %s" % (p1[0].line,p2[0].line) | ||
| 67 | coccilib.report.print_report(p3[0],msg) | ||
diff --git a/scripts/coccinelle/misc/boolinit.cocci b/scripts/coccinelle/misc/boolinit.cocci new file mode 100644 index 000000000000..97ce41ce8135 --- /dev/null +++ b/scripts/coccinelle/misc/boolinit.cocci | |||
| @@ -0,0 +1,178 @@ | |||
| 1 | /// Bool initializations should use true and false. Bool tests don't need | ||
| 2 | /// comparisons. Based on contributions from Joe Perches, Rusty Russell | ||
| 3 | /// and Bruce W Allan. | ||
| 4 | /// | ||
| 5 | // Confidence: High | ||
| 6 | // Copyright: (C) 2012 Julia Lawall, INRIA/LIP6. GPLv2. | ||
| 7 | // Copyright: (C) 2012 Gilles Muller, INRIA/LiP6. GPLv2. | ||
| 8 | // URL: http://coccinelle.lip6.fr/ | ||
| 9 | // Options: -include_headers | ||
| 10 | |||
| 11 | virtual patch | ||
| 12 | virtual context | ||
| 13 | virtual org | ||
| 14 | virtual report | ||
| 15 | |||
| 16 | @depends on patch@ | ||
| 17 | bool t; | ||
| 18 | symbol true; | ||
| 19 | symbol false; | ||
| 20 | @@ | ||
| 21 | |||
| 22 | ( | ||
| 23 | - t == true | ||
| 24 | + t | ||
| 25 | | | ||
| 26 | - true == t | ||
| 27 | + t | ||
| 28 | | | ||
| 29 | - t != true | ||
| 30 | + !t | ||
| 31 | | | ||
| 32 | - true != t | ||
| 33 | + !t | ||
| 34 | | | ||
| 35 | - t == false | ||
| 36 | + !t | ||
| 37 | | | ||
| 38 | - false == t | ||
| 39 | + !t | ||
| 40 | | | ||
| 41 | - t != false | ||
| 42 | + t | ||
| 43 | | | ||
| 44 | - false != t | ||
| 45 | + t | ||
| 46 | ) | ||
| 47 | |||
| 48 | @depends on patch disable is_zero, isnt_zero@ | ||
| 49 | bool t; | ||
| 50 | @@ | ||
| 51 | |||
| 52 | ( | ||
| 53 | - t == 1 | ||
| 54 | + t | ||
| 55 | | | ||
| 56 | - t != 1 | ||
| 57 | + !t | ||
| 58 | | | ||
| 59 | - t == 0 | ||
| 60 | + !t | ||
| 61 | | | ||
| 62 | - t != 0 | ||
| 63 | + t | ||
| 64 | ) | ||
| 65 | |||
| 66 | @depends on patch@ | ||
| 67 | bool b; | ||
| 68 | @@ | ||
| 69 | ( | ||
| 70 | b = | ||
| 71 | - 0 | ||
| 72 | + false | ||
| 73 | | | ||
| 74 | b = | ||
| 75 | - 1 | ||
| 76 | + true | ||
| 77 | ) | ||
| 78 | |||
| 79 | // --------------------------------------------------------------------- | ||
| 80 | |||
| 81 | @r1 depends on !patch@ | ||
| 82 | bool t; | ||
| 83 | position p; | ||
| 84 | @@ | ||
| 85 | |||
| 86 | ( | ||
| 87 | * t@p == true | ||
| 88 | | | ||
| 89 | * true == t@p | ||
| 90 | | | ||
| 91 | * t@p != true | ||
| 92 | | | ||
| 93 | * true != t@p | ||
| 94 | | | ||
| 95 | * t@p == false | ||
| 96 | | | ||
| 97 | * false == t@p | ||
| 98 | | | ||
| 99 | * t@p != false | ||
| 100 | | | ||
| 101 | * false != t@p | ||
| 102 | ) | ||
| 103 | |||
| 104 | @r2 depends on !patch disable is_zero, isnt_zero@ | ||
| 105 | bool t; | ||
| 106 | position p; | ||
| 107 | @@ | ||
| 108 | |||
| 109 | ( | ||
| 110 | * t@p == 1 | ||
| 111 | | | ||
| 112 | * t@p != 1 | ||
| 113 | | | ||
| 114 | * t@p == 0 | ||
| 115 | | | ||
| 116 | * t@p != 0 | ||
| 117 | ) | ||
| 118 | |||
| 119 | @r3 depends on !patch@ | ||
| 120 | bool b; | ||
| 121 | position p1,p2; | ||
| 122 | constant c; | ||
| 123 | @@ | ||
| 124 | ( | ||
| 125 | *b@p1 = 0 | ||
| 126 | | | ||
| 127 | *b@p1 = 1 | ||
| 128 | | | ||
| 129 | *b@p2 = c | ||
| 130 | ) | ||
| 131 | |||
| 132 | @script:python depends on org@ | ||
| 133 | p << r1.p; | ||
| 134 | @@ | ||
| 135 | |||
| 136 | cocci.print_main("WARNING: Comparison to bool",p) | ||
| 137 | |||
| 138 | @script:python depends on org@ | ||
| 139 | p << r2.p; | ||
| 140 | @@ | ||
| 141 | |||
| 142 | cocci.print_main("WARNING: Comparison of bool to 0/1",p) | ||
| 143 | |||
| 144 | @script:python depends on org@ | ||
| 145 | p1 << r3.p1; | ||
| 146 | @@ | ||
| 147 | |||
| 148 | cocci.print_main("WARNING: Assignment of bool to 0/1",p1) | ||
| 149 | |||
| 150 | @script:python depends on org@ | ||
| 151 | p2 << r3.p2; | ||
| 152 | @@ | ||
| 153 | |||
| 154 | cocci.print_main("ERROR: Assignment of bool to non-0/1 constant",p2) | ||
| 155 | |||
| 156 | @script:python depends on report@ | ||
| 157 | p << r1.p; | ||
| 158 | @@ | ||
| 159 | |||
| 160 | coccilib.report.print_report(p[0],"WARNING: Comparison to bool") | ||
| 161 | |||
| 162 | @script:python depends on report@ | ||
| 163 | p << r2.p; | ||
| 164 | @@ | ||
| 165 | |||
| 166 | coccilib.report.print_report(p[0],"WARNING: Comparison of bool to 0/1") | ||
| 167 | |||
| 168 | @script:python depends on report@ | ||
| 169 | p1 << r3.p1; | ||
| 170 | @@ | ||
| 171 | |||
| 172 | coccilib.report.print_report(p1[0],"WARNING: Assignment of bool to 0/1") | ||
| 173 | |||
| 174 | @script:python depends on report@ | ||
| 175 | p2 << r3.p2; | ||
| 176 | @@ | ||
| 177 | |||
| 178 | coccilib.report.print_report(p2[0],"ERROR: Assignment of bool to non-0/1 constant") | ||
diff --git a/scripts/coccinelle/misc/cstptr.cocci b/scripts/coccinelle/misc/cstptr.cocci new file mode 100644 index 000000000000..d42564484528 --- /dev/null +++ b/scripts/coccinelle/misc/cstptr.cocci | |||
| @@ -0,0 +1,41 @@ | |||
| 1 | /// PTR_ERR should be applied before its argument is reassigned, typically | ||
| 2 | /// to NULL | ||
| 3 | /// | ||
| 4 | // Confidence: High | ||
| 5 | // Copyright: (C) 2012 Julia Lawall, INRIA/LIP6. GPLv2. | ||
| 6 | // Copyright: (C) 2012 Gilles Muller, INRIA/LiP6. GPLv2. | ||
| 7 | // URL: http://coccinelle.lip6.fr/ | ||
| 8 | // Comments: | ||
| 9 | // Options: -no_includes -include_headers | ||
| 10 | |||
| 11 | virtual org | ||
| 12 | virtual report | ||
| 13 | virtual context | ||
| 14 | |||
| 15 | @r exists@ | ||
| 16 | expression e,e1; | ||
| 17 | constant c; | ||
| 18 | position p1,p2; | ||
| 19 | @@ | ||
| 20 | |||
| 21 | *e@p1 = c | ||
| 22 | ... when != e = e1 | ||
| 23 | when != &e | ||
| 24 | when != true IS_ERR(e) | ||
| 25 | *PTR_ERR@p2(e) | ||
| 26 | |||
| 27 | @script:python depends on org@ | ||
| 28 | p1 << r.p1; | ||
| 29 | p2 << r.p2; | ||
| 30 | @@ | ||
| 31 | |||
| 32 | cocci.print_main("PTR_ERR",p2) | ||
| 33 | cocci.print_secs("assignment",p1) | ||
| 34 | |||
| 35 | @script:python depends on report@ | ||
| 36 | p1 << r.p1; | ||
| 37 | p2 << r.p2; | ||
| 38 | @@ | ||
| 39 | |||
| 40 | msg = "ERROR: PTR_ERR applied after initialization to constant on line %s" % (p1[0].line) | ||
| 41 | coccilib.report.print_report(p2[0],msg) | ||
diff --git a/scripts/coccinelle/null/badzero.cocci b/scripts/coccinelle/null/badzero.cocci new file mode 100644 index 000000000000..d79baf7220e7 --- /dev/null +++ b/scripts/coccinelle/null/badzero.cocci | |||
| @@ -0,0 +1,237 @@ | |||
| 1 | /// Compare pointer-typed values to NULL rather than 0 | ||
| 2 | /// | ||
| 3 | //# This makes an effort to choose between !x and x == NULL. !x is used | ||
| 4 | //# if it has previously been used with the function used to initialize x. | ||
| 5 | //# This relies on type information. More type information can be obtained | ||
| 6 | //# using the option -all_includes and the option -I to specify an | ||
| 7 | //# include path. | ||
| 8 | // | ||
| 9 | // Confidence: High | ||
| 10 | // Copyright: (C) 2012 Julia Lawall, INRIA/LIP6. GPLv2. | ||
| 11 | // Copyright: (C) 2012 Gilles Muller, INRIA/LiP6. GPLv2. | ||
| 12 | // URL: http://coccinelle.lip6.fr/ | ||
| 13 | // Comments: | ||
| 14 | // Options: | ||
| 15 | |||
| 16 | virtual patch | ||
| 17 | virtual context | ||
| 18 | virtual org | ||
| 19 | virtual report | ||
| 20 | |||
| 21 | @initialize:ocaml@ | ||
| 22 | let negtable = Hashtbl.create 101 | ||
| 23 | |||
| 24 | @depends on patch@ | ||
| 25 | expression *E; | ||
| 26 | identifier f; | ||
| 27 | @@ | ||
| 28 | |||
| 29 | ( | ||
| 30 | (E = f(...)) == | ||
| 31 | - 0 | ||
| 32 | + NULL | ||
| 33 | | | ||
| 34 | (E = f(...)) != | ||
| 35 | - 0 | ||
| 36 | + NULL | ||
| 37 | | | ||
| 38 | - 0 | ||
| 39 | + NULL | ||
| 40 | == (E = f(...)) | ||
| 41 | | | ||
| 42 | - 0 | ||
| 43 | + NULL | ||
| 44 | != (E = f(...)) | ||
| 45 | ) | ||
| 46 | |||
| 47 | |||
| 48 | @t1 depends on !patch@ | ||
| 49 | expression *E; | ||
| 50 | identifier f; | ||
| 51 | position p; | ||
| 52 | @@ | ||
| 53 | |||
| 54 | ( | ||
| 55 | (E = f(...)) == | ||
| 56 | * 0@p | ||
| 57 | | | ||
| 58 | (E = f(...)) != | ||
| 59 | * 0@p | ||
| 60 | | | ||
| 61 | * 0@p | ||
| 62 | == (E = f(...)) | ||
| 63 | | | ||
| 64 | * 0@p | ||
| 65 | != (E = f(...)) | ||
| 66 | ) | ||
| 67 | |||
| 68 | @script:python depends on org@ | ||
| 69 | p << t1.p; | ||
| 70 | @@ | ||
| 71 | |||
| 72 | coccilib.org.print_todo(p[0], "WARNING comparing pointer to 0") | ||
| 73 | |||
| 74 | @script:python depends on report@ | ||
| 75 | p << t1.p; | ||
| 76 | @@ | ||
| 77 | |||
| 78 | coccilib.report.print_report(p[0], "WARNING comparing pointer to 0") | ||
| 79 | |||
| 80 | // Tests of returned values | ||
| 81 | |||
| 82 | @s@ | ||
| 83 | identifier f; | ||
| 84 | expression E,E1; | ||
| 85 | @@ | ||
| 86 | |||
| 87 | E = f(...) | ||
| 88 | ... when != E = E1 | ||
| 89 | !E | ||
| 90 | |||
| 91 | @script:ocaml depends on s@ | ||
| 92 | f << s.f; | ||
| 93 | @@ | ||
| 94 | |||
| 95 | try let _ = Hashtbl.find negtable f in () | ||
| 96 | with Not_found -> Hashtbl.add negtable f () | ||
| 97 | |||
| 98 | @ r disable is_zero,isnt_zero exists @ | ||
| 99 | expression *E; | ||
| 100 | identifier f; | ||
| 101 | @@ | ||
| 102 | |||
| 103 | E = f(...) | ||
| 104 | ... | ||
| 105 | (E == 0 | ||
| 106 | |E != 0 | ||
| 107 | |0 == E | ||
| 108 | |0 != E | ||
| 109 | ) | ||
| 110 | |||
| 111 | @script:ocaml@ | ||
| 112 | f << r.f; | ||
| 113 | @@ | ||
| 114 | |||
| 115 | try let _ = Hashtbl.find negtable f in () | ||
| 116 | with Not_found -> include_match false | ||
| 117 | |||
| 118 | // This rule may lead to inconsistent path problems, if E is defined in two | ||
| 119 | // places | ||
| 120 | @ depends on patch disable is_zero,isnt_zero @ | ||
| 121 | expression *E; | ||
| 122 | expression E1; | ||
| 123 | identifier r.f; | ||
| 124 | @@ | ||
| 125 | |||
| 126 | E = f(...) | ||
| 127 | <... | ||
| 128 | ( | ||
| 129 | - E == 0 | ||
| 130 | + !E | ||
| 131 | | | ||
| 132 | - E != 0 | ||
| 133 | + E | ||
| 134 | | | ||
| 135 | - 0 == E | ||
| 136 | + !E | ||
| 137 | | | ||
| 138 | - 0 != E | ||
| 139 | + E | ||
| 140 | ) | ||
| 141 | ...> | ||
| 142 | ?E = E1 | ||
| 143 | |||
| 144 | @t2 depends on !patch disable is_zero,isnt_zero @ | ||
| 145 | expression *E; | ||
| 146 | expression E1; | ||
| 147 | identifier r.f; | ||
| 148 | position p1; | ||
| 149 | position p2; | ||
| 150 | @@ | ||
| 151 | |||
| 152 | E = f(...) | ||
| 153 | <... | ||
| 154 | ( | ||
| 155 | * E == 0@p1 | ||
| 156 | | | ||
| 157 | * E != 0@p2 | ||
| 158 | | | ||
| 159 | * 0@p1 == E | ||
| 160 | | | ||
| 161 | * 0@p1 != E | ||
| 162 | ) | ||
| 163 | ...> | ||
| 164 | ?E = E1 | ||
| 165 | |||
| 166 | @script:python depends on org@ | ||
| 167 | p << t2.p1; | ||
| 168 | @@ | ||
| 169 | |||
| 170 | coccilib.org.print_todo(p[0], "WARNING comparing pointer to 0, suggest !E") | ||
| 171 | |||
| 172 | @script:python depends on org@ | ||
| 173 | p << t2.p2; | ||
| 174 | @@ | ||
| 175 | |||
| 176 | coccilib.org.print_todo(p[0], "WARNING comparing pointer to 0") | ||
| 177 | |||
| 178 | @script:python depends on report@ | ||
| 179 | p << t2.p1; | ||
| 180 | @@ | ||
| 181 | |||
| 182 | coccilib.report.print_report(p[0], "WARNING comparing pointer to 0, suggest !E") | ||
| 183 | |||
| 184 | @script:python depends on report@ | ||
| 185 | p << t2.p2; | ||
| 186 | @@ | ||
| 187 | |||
| 188 | coccilib.report.print_report(p[0], "WARNING comparing pointer to 0") | ||
| 189 | |||
| 190 | @ depends on patch disable is_zero,isnt_zero @ | ||
| 191 | expression *E; | ||
| 192 | @@ | ||
| 193 | |||
| 194 | ( | ||
| 195 | E == | ||
| 196 | - 0 | ||
| 197 | + NULL | ||
| 198 | | | ||
| 199 | E != | ||
| 200 | - 0 | ||
| 201 | + NULL | ||
| 202 | | | ||
| 203 | - 0 | ||
| 204 | + NULL | ||
| 205 | == E | ||
| 206 | | | ||
| 207 | - 0 | ||
| 208 | + NULL | ||
| 209 | != E | ||
| 210 | ) | ||
| 211 | |||
| 212 | @ t3 depends on !patch disable is_zero,isnt_zero @ | ||
| 213 | expression *E; | ||
| 214 | position p; | ||
| 215 | @@ | ||
| 216 | |||
| 217 | ( | ||
| 218 | * E == 0@p | ||
| 219 | | | ||
| 220 | * E != 0@p | ||
| 221 | | | ||
| 222 | * 0@p == E | ||
| 223 | | | ||
| 224 | * 0@p != E | ||
| 225 | ) | ||
| 226 | |||
| 227 | @script:python depends on org@ | ||
| 228 | p << t3.p; | ||
| 229 | @@ | ||
| 230 | |||
| 231 | coccilib.org.print_todo(p[0], "WARNING comparing pointer to 0") | ||
| 232 | |||
| 233 | @script:python depends on report@ | ||
| 234 | p << t3.p; | ||
| 235 | @@ | ||
| 236 | |||
| 237 | coccilib.report.print_report(p[0], "WARNING comparing pointer to 0") | ||
diff --git a/scripts/package/builddeb b/scripts/package/builddeb index 3c6c0b14c807..eee5f8ed2493 100644 --- a/scripts/package/builddeb +++ b/scripts/package/builddeb | |||
| @@ -97,6 +97,7 @@ mkdir -m 755 -p "$libc_headers_dir/DEBIAN" | |||
| 97 | mkdir -p "$libc_headers_dir/usr/share/doc/$libc_headers_packagename" | 97 | mkdir -p "$libc_headers_dir/usr/share/doc/$libc_headers_packagename" |
| 98 | mkdir -m 755 -p "$kernel_headers_dir/DEBIAN" | 98 | mkdir -m 755 -p "$kernel_headers_dir/DEBIAN" |
| 99 | mkdir -p "$kernel_headers_dir/usr/share/doc/$kernel_headers_packagename" | 99 | mkdir -p "$kernel_headers_dir/usr/share/doc/$kernel_headers_packagename" |
| 100 | mkdir -p "$kernel_headers_dir/lib/modules/$version/" | ||
| 100 | if [ "$ARCH" = "um" ] ; then | 101 | if [ "$ARCH" = "um" ] ; then |
| 101 | mkdir -p "$tmpdir/usr/lib/uml/modules/$version" "$tmpdir/usr/bin" | 102 | mkdir -p "$tmpdir/usr/lib/uml/modules/$version" "$tmpdir/usr/bin" |
| 102 | fi | 103 | fi |
| @@ -120,15 +121,19 @@ else | |||
| 120 | fi | 121 | fi |
| 121 | 122 | ||
| 122 | if grep -q '^CONFIG_MODULES=y' .config ; then | 123 | if grep -q '^CONFIG_MODULES=y' .config ; then |
| 123 | INSTALL_MOD_PATH="$tmpdir" make KBUILD_SRC= modules_install | 124 | INSTALL_MOD_PATH="$tmpdir" $MAKE KBUILD_SRC= modules_install |
| 125 | rm -f "$tmpdir/lib/modules/$version/build" | ||
| 126 | rm -f "$tmpdir/lib/modules/$version/source" | ||
| 124 | if [ "$ARCH" = "um" ] ; then | 127 | if [ "$ARCH" = "um" ] ; then |
| 125 | mv "$tmpdir/lib/modules/$version"/* "$tmpdir/usr/lib/uml/modules/$version/" | 128 | mv "$tmpdir/lib/modules/$version"/* "$tmpdir/usr/lib/uml/modules/$version/" |
| 126 | rmdir "$tmpdir/lib/modules/$version" | 129 | rmdir "$tmpdir/lib/modules/$version" |
| 127 | fi | 130 | fi |
| 128 | fi | 131 | fi |
| 129 | 132 | ||
| 130 | make headers_check | 133 | if [ "$ARCH" != "um" ]; then |
| 131 | make headers_install INSTALL_HDR_PATH="$libc_headers_dir/usr" | 134 | $MAKE headers_check KBUILD_SRC= |
| 135 | $MAKE headers_install KBUILD_SRC= INSTALL_HDR_PATH="$libc_headers_dir/usr" | ||
| 136 | fi | ||
| 132 | 137 | ||
| 133 | # Install the maintainer scripts | 138 | # Install the maintainer scripts |
| 134 | # Note: hook scripts under /etc/kernel are also executed by official Debian | 139 | # Note: hook scripts under /etc/kernel are also executed by official Debian |
| @@ -245,6 +250,7 @@ destdir=$kernel_headers_dir/usr/src/linux-headers-$version | |||
| 245 | mkdir -p "$destdir" | 250 | mkdir -p "$destdir" |
| 246 | (cd $srctree; tar -c -f - -T "$objtree/debian/hdrsrcfiles") | (cd $destdir; tar -xf -) | 251 | (cd $srctree; tar -c -f - -T "$objtree/debian/hdrsrcfiles") | (cd $destdir; tar -xf -) |
| 247 | (cd $objtree; tar -c -f - -T "$objtree/debian/hdrobjfiles") | (cd $destdir; tar -xf -) | 252 | (cd $objtree; tar -c -f - -T "$objtree/debian/hdrobjfiles") | (cd $destdir; tar -xf -) |
| 253 | ln -sf "/usr/src/linux-headers-$version" "$kernel_headers_dir/lib/modules/$version/build" | ||
| 248 | rm -f "$objtree/debian/hdrsrcfiles" "$objtree/debian/hdrobjfiles" | 254 | rm -f "$objtree/debian/hdrsrcfiles" "$objtree/debian/hdrobjfiles" |
| 249 | arch=$(dpkg --print-architecture) | 255 | arch=$(dpkg --print-architecture) |
| 250 | 256 | ||
| @@ -259,8 +265,6 @@ Description: Linux kernel headers for $KERNELRELEASE on $arch | |||
| 259 | This is useful for people who need to build external modules | 265 | This is useful for people who need to build external modules |
| 260 | EOF | 266 | EOF |
| 261 | 267 | ||
| 262 | create_package "$kernel_headers_packagename" "$kernel_headers_dir" | ||
| 263 | |||
| 264 | # Do we have firmware? Move it out of the way and build it into a package. | 268 | # Do we have firmware? Move it out of the way and build it into a package. |
| 265 | if [ -e "$tmpdir/lib/firmware" ]; then | 269 | if [ -e "$tmpdir/lib/firmware" ]; then |
| 266 | mv "$tmpdir/lib/firmware" "$fwdir/lib/" | 270 | mv "$tmpdir/lib/firmware" "$fwdir/lib/" |
| @@ -287,7 +291,11 @@ Description: Linux support headers for userspace development | |||
| 287 | are used by the installed headers for GNU glibc and other system libraries. | 291 | are used by the installed headers for GNU glibc and other system libraries. |
| 288 | EOF | 292 | EOF |
| 289 | 293 | ||
| 290 | create_package "$libc_headers_packagename" "$libc_headers_dir" | 294 | if [ "$ARCH" != "um" ]; then |
| 295 | create_package "$kernel_headers_packagename" "$kernel_headers_dir" | ||
| 296 | create_package "$libc_headers_packagename" "$libc_headers_dir" | ||
| 297 | fi | ||
| 298 | |||
| 291 | create_package "$packagename" "$tmpdir" | 299 | create_package "$packagename" "$tmpdir" |
| 292 | 300 | ||
| 293 | exit 0 | 301 | exit 0 |
diff --git a/scripts/patch-kernel b/scripts/patch-kernel index 20fb25c23382..d000ea3a41fd 100755 --- a/scripts/patch-kernel +++ b/scripts/patch-kernel | |||
| @@ -116,6 +116,10 @@ findFile () { | |||
| 116 | ext=".bz2" | 116 | ext=".bz2" |
| 117 | name="bzip2" | 117 | name="bzip2" |
| 118 | uncomp="bunzip2 -dc" | 118 | uncomp="bunzip2 -dc" |
| 119 | elif [ -r ${filebase}.xz ]; then | ||
| 120 | ext=".xz" | ||
| 121 | name="xz" | ||
| 122 | uncomp="xz -dc" | ||
| 119 | elif [ -r ${filebase}.zip ]; then | 123 | elif [ -r ${filebase}.zip ]; then |
| 120 | ext=".zip" | 124 | ext=".zip" |
| 121 | name="zip" | 125 | name="zip" |
diff --git a/scripts/tags.sh b/scripts/tags.sh index 833813a99e7c..0d6004e20658 100755 --- a/scripts/tags.sh +++ b/scripts/tags.sh | |||
| @@ -116,7 +116,7 @@ docscope() | |||
| 116 | 116 | ||
| 117 | dogtags() | 117 | dogtags() |
| 118 | { | 118 | { |
| 119 | all_sources | gtags -f - | 119 | all_sources | gtags -i -f - |
| 120 | } | 120 | } |
| 121 | 121 | ||
| 122 | exuberant() | 122 | exuberant() |
| @@ -166,9 +166,6 @@ exuberant() | |||
| 166 | all_defconfigs | xargs -r $1 -a \ | 166 | all_defconfigs | xargs -r $1 -a \ |
| 167 | --langdef=dotconfig --language-force=dotconfig \ | 167 | --langdef=dotconfig --language-force=dotconfig \ |
| 168 | --regex-dotconfig='/^#?[[:blank:]]*(CONFIG_[[:alnum:]_]+)/\1/' | 168 | --regex-dotconfig='/^#?[[:blank:]]*(CONFIG_[[:alnum:]_]+)/\1/' |
| 169 | |||
| 170 | # Remove structure forward declarations. | ||
| 171 | LANG=C sed -i -e '/^\([a-zA-Z_][a-zA-Z0-9_]*\)\t.*\t\/\^struct \1;.*\$\/;"\tx$/d' tags | ||
| 172 | } | 169 | } |
| 173 | 170 | ||
| 174 | emacs() | 171 | emacs() |
| @@ -233,6 +230,7 @@ if [ "${ARCH}" = "um" ]; then | |||
| 233 | fi | 230 | fi |
| 234 | fi | 231 | fi |
| 235 | 232 | ||
| 233 | remove_structs= | ||
| 236 | case "$1" in | 234 | case "$1" in |
| 237 | "cscope") | 235 | "cscope") |
| 238 | docscope | 236 | docscope |
| @@ -245,10 +243,17 @@ case "$1" in | |||
| 245 | "tags") | 243 | "tags") |
| 246 | rm -f tags | 244 | rm -f tags |
| 247 | xtags ctags | 245 | xtags ctags |
| 246 | remove_structs=y | ||
| 248 | ;; | 247 | ;; |
| 249 | 248 | ||
| 250 | "TAGS") | 249 | "TAGS") |
| 251 | rm -f TAGS | 250 | rm -f TAGS |
| 252 | xtags etags | 251 | xtags etags |
| 252 | remove_structs=y | ||
| 253 | ;; | 253 | ;; |
| 254 | esac | 254 | esac |
| 255 | |||
| 256 | # Remove structure forward declarations. | ||
| 257 | if [ -n $remove_structs ]; then | ||
| 258 | LANG=C sed -i -e '/^\([a-zA-Z_][a-zA-Z0-9_]*\)\t.*\t\/\^struct \1;.*\$\/;"\tx$/d' $1 | ||
| 259 | fi | ||
