diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-05 17:20:14 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-05 17:20:14 -0400 |
commit | f43100ae39bfeb757b75835ef61f0c2c46c99348 (patch) | |
tree | 620379bb9a2287975ee222c449cd69d31738096e | |
parent | 27b4a1a9eac8b0f8958da67e4abe025b96e1a293 (diff) | |
parent | 5e8e1cc0a1c36c8ff156ac1f04a16422bd4ed3ac (diff) |
Merge branch 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6
* 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6:
scripts/dtc: Fix a resource leak
Documentation: fix ubuntu distro name
MAINTAINERS: Update kbuild git URLs
Add support for the C variable in the coccicheck script
Add scripts/coccinelle/deref_null.cocci
Add scripts/coccinelle/err_cast.cocci
Add scripts/coccinelle/resource_size.cocci
Add scripts/coccinelle/alloc/kzalloc-simple.cocci
Add scripts/coccinelle/alloc/drop_kmalloc_cast.cocci
Add Documentation/coccinelle.txt
Add a target to use the Coccinelle checker
scripts: decodecode: remove bashisms
Makefile: clarify a comment
checkkconfigsymbols.sh: Kconfig symbols sometimes have lowercase letters
scripts: add nconf into gitignore file
-rw-r--r-- | Documentation/coccinelle.txt | 258 | ||||
-rw-r--r-- | MAINTAINERS | 14 | ||||
-rw-r--r-- | Makefile | 12 | ||||
-rw-r--r-- | scripts/Makefile.help | 3 | ||||
-rwxr-xr-x | scripts/checkkconfigsymbols.sh | 2 | ||||
-rwxr-xr-x | scripts/coccicheck | 80 | ||||
-rw-r--r-- | scripts/coccinelle/alloc/drop_kmalloc_cast.cocci | 67 | ||||
-rw-r--r-- | scripts/coccinelle/alloc/kzalloc-simple.cocci | 82 | ||||
-rw-r--r-- | scripts/coccinelle/deref_null.cocci | 293 | ||||
-rw-r--r-- | scripts/coccinelle/err_cast.cocci | 56 | ||||
-rw-r--r-- | scripts/coccinelle/resource_size.cocci | 93 | ||||
-rwxr-xr-x | scripts/decodecode | 10 | ||||
-rw-r--r-- | scripts/dtc/fstree.c | 1 | ||||
-rw-r--r-- | scripts/kconfig/.gitignore | 1 |
14 files changed, 960 insertions, 12 deletions
diff --git a/Documentation/coccinelle.txt b/Documentation/coccinelle.txt new file mode 100644 index 000000000000..cd2b02837066 --- /dev/null +++ b/Documentation/coccinelle.txt | |||
@@ -0,0 +1,258 @@ | |||
1 | Copyright 2010 Nicolas Palix <npalix@diku.dk> | ||
2 | Copyright 2010 Julia Lawall <julia@diku.dk> | ||
3 | Copyright 2010 Gilles Muller <Gilles.Muller@lip6.fr> | ||
4 | |||
5 | |||
6 | Getting Coccinelle | ||
7 | ~~~~~~~~~~~~~~~~~~~~ | ||
8 | |||
9 | The semantic patches included in the kernel use the 'virtual rule' | ||
10 | feature which was introduced in Coccinelle version 0.1.11. | ||
11 | |||
12 | Coccinelle (>=0.2.0) is available through the package manager | ||
13 | of many distributions, e.g. : | ||
14 | |||
15 | - Debian (>=squeeze) | ||
16 | - Fedora (>=13) | ||
17 | - Ubuntu (>=10.04 Lucid Lynx) | ||
18 | - OpenSUSE | ||
19 | - Arch Linux | ||
20 | - NetBSD | ||
21 | - FreeBSD | ||
22 | |||
23 | |||
24 | You can get the latest version released from the Coccinelle homepage at | ||
25 | http://coccinelle.lip6.fr/ | ||
26 | |||
27 | Once you have it, run the following command: | ||
28 | |||
29 | ./configure | ||
30 | make | ||
31 | |||
32 | as a regular user, and install it with | ||
33 | |||
34 | sudo make install | ||
35 | |||
36 | |||
37 | Using Coccinelle on the Linux kernel | ||
38 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
39 | |||
40 | A Coccinelle-specific target is defined in the top level | ||
41 | Makefile. This target is named 'coccicheck' and calls the 'coccicheck' | ||
42 | front-end in the 'scripts' directory. | ||
43 | |||
44 | Four modes are defined: report, patch, context, and org. The mode to | ||
45 | use is specified by setting the MODE variable with 'MODE=<mode>'. | ||
46 | |||
47 | 'report' generates a list in the following format: | ||
48 | file:line:column-column: message | ||
49 | |||
50 | 'patch' proposes a fix, when possible. | ||
51 | |||
52 | 'context' highlights lines of interest and their context in a | ||
53 | diff-like style.Lines of interest are indicated with '-'. | ||
54 | |||
55 | 'org' generates a report in the Org mode format of Emacs. | ||
56 | |||
57 | Note that not all semantic patches implement all modes. | ||
58 | |||
59 | To make a report for every semantic patch, run the following command: | ||
60 | |||
61 | make coccicheck MODE=report | ||
62 | |||
63 | NB: The 'report' mode is the default one. | ||
64 | |||
65 | To produce patches, run: | ||
66 | |||
67 | make coccicheck MODE=patch | ||
68 | |||
69 | |||
70 | The coccicheck target applies every semantic patch available in the | ||
71 | subdirectories of 'scripts/coccinelle' to the entire Linux kernel. | ||
72 | |||
73 | For each semantic patch, a changelog message is proposed. It gives a | ||
74 | description of the problem being checked by the semantic patch, and | ||
75 | includes a reference to Coccinelle. | ||
76 | |||
77 | As any static code analyzer, Coccinelle produces false | ||
78 | positives. Thus, reports must be carefully checked, and patches | ||
79 | reviewed. | ||
80 | |||
81 | |||
82 | Using Coccinelle with a single semantic patch | ||
83 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
84 | |||
85 | The optional make variable COCCI can be used to check a single | ||
86 | semantic patch. In that case, the variable must be initialized with | ||
87 | the name of the semantic patch to apply. | ||
88 | |||
89 | For instance: | ||
90 | |||
91 | make coccicheck COCCI=<my_SP.cocci> MODE=patch | ||
92 | or | ||
93 | make coccicheck COCCI=<my_SP.cocci> MODE=report | ||
94 | |||
95 | |||
96 | Proposing new semantic patches | ||
97 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
98 | |||
99 | New semantic patches can be proposed and submitted by kernel | ||
100 | developers. For sake of clarity, they should be organized in the | ||
101 | subdirectories of 'scripts/coccinelle/'. | ||
102 | |||
103 | |||
104 | Detailed description of the 'report' mode | ||
105 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
106 | |||
107 | 'report' generates a list in the following format: | ||
108 | file:line:column-column: message | ||
109 | |||
110 | Example: | ||
111 | |||
112 | Running | ||
113 | |||
114 | make coccicheck MODE=report COCCI=scripts/coccinelle/err_cast.cocci | ||
115 | |||
116 | will execute the following part of the SmPL script. | ||
117 | |||
118 | <smpl> | ||
119 | @r depends on !context && !patch && (org || report)@ | ||
120 | expression x; | ||
121 | position p; | ||
122 | @@ | ||
123 | |||
124 | ERR_PTR@p(PTR_ERR(x)) | ||
125 | |||
126 | @script:python depends on report@ | ||
127 | p << r.p; | ||
128 | x << r.x; | ||
129 | @@ | ||
130 | |||
131 | msg="ERR_CAST can be used with %s" % (x) | ||
132 | coccilib.report.print_report(p[0], msg) | ||
133 | </smpl> | ||
134 | |||
135 | This SmPL excerpt generates entries on the standard output, as | ||
136 | illustrated below: | ||
137 | |||
138 | /home/user/linux/crypto/ctr.c:188:9-16: ERR_CAST can be used with alg | ||
139 | /home/user/linux/crypto/authenc.c:619:9-16: ERR_CAST can be used with auth | ||
140 | /home/user/linux/crypto/xts.c:227:9-16: ERR_CAST can be used with alg | ||
141 | |||
142 | |||
143 | Detailed description of the 'patch' mode | ||
144 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
145 | |||
146 | When the 'patch' mode is available, it proposes a fix for each problem | ||
147 | identified. | ||
148 | |||
149 | Example: | ||
150 | |||
151 | Running | ||
152 | make coccicheck MODE=patch COCCI=scripts/coccinelle/err_cast.cocci | ||
153 | |||
154 | will execute the following part of the SmPL script. | ||
155 | |||
156 | <smpl> | ||
157 | @ depends on !context && patch && !org && !report @ | ||
158 | expression x; | ||
159 | @@ | ||
160 | |||
161 | - ERR_PTR(PTR_ERR(x)) | ||
162 | + ERR_CAST(x) | ||
163 | </smpl> | ||
164 | |||
165 | This SmPL excerpt generates patch hunks on the standard output, as | ||
166 | illustrated below: | ||
167 | |||
168 | diff -u -p a/crypto/ctr.c b/crypto/ctr.c | ||
169 | --- a/crypto/ctr.c 2010-05-26 10:49:38.000000000 +0200 | ||
170 | +++ b/crypto/ctr.c 2010-06-03 23:44:49.000000000 +0200 | ||
171 | @@ -185,7 +185,7 @@ static struct crypto_instance *crypto_ct | ||
172 | alg = crypto_attr_alg(tb[1], CRYPTO_ALG_TYPE_CIPHER, | ||
173 | CRYPTO_ALG_TYPE_MASK); | ||
174 | if (IS_ERR(alg)) | ||
175 | - return ERR_PTR(PTR_ERR(alg)); | ||
176 | + return ERR_CAST(alg); | ||
177 | |||
178 | /* Block size must be >= 4 bytes. */ | ||
179 | err = -EINVAL; | ||
180 | |||
181 | Detailed description of the 'context' mode | ||
182 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
183 | |||
184 | 'context' highlights lines of interest and their context | ||
185 | in a diff-like style. | ||
186 | |||
187 | NOTE: The diff-like output generated is NOT an applicable patch. The | ||
188 | intent of the 'context' mode is to highlight the important lines | ||
189 | (annotated with minus, '-') and gives some surrounding context | ||
190 | lines around. This output can be used with the diff mode of | ||
191 | Emacs to review the code. | ||
192 | |||
193 | Example: | ||
194 | |||
195 | Running | ||
196 | make coccicheck MODE=context COCCI=scripts/coccinelle/err_cast.cocci | ||
197 | |||
198 | will execute the following part of the SmPL script. | ||
199 | |||
200 | <smpl> | ||
201 | @ depends on context && !patch && !org && !report@ | ||
202 | expression x; | ||
203 | @@ | ||
204 | |||
205 | * ERR_PTR(PTR_ERR(x)) | ||
206 | </smpl> | ||
207 | |||
208 | This SmPL excerpt generates diff hunks on the standard output, as | ||
209 | illustrated below: | ||
210 | |||
211 | diff -u -p /home/user/linux/crypto/ctr.c /tmp/nothing | ||
212 | --- /home/user/linux/crypto/ctr.c 2010-05-26 10:49:38.000000000 +0200 | ||
213 | +++ /tmp/nothing | ||
214 | @@ -185,7 +185,6 @@ static struct crypto_instance *crypto_ct | ||
215 | alg = crypto_attr_alg(tb[1], CRYPTO_ALG_TYPE_CIPHER, | ||
216 | CRYPTO_ALG_TYPE_MASK); | ||
217 | if (IS_ERR(alg)) | ||
218 | - return ERR_PTR(PTR_ERR(alg)); | ||
219 | |||
220 | /* Block size must be >= 4 bytes. */ | ||
221 | err = -EINVAL; | ||
222 | |||
223 | Detailed description of the 'org' mode | ||
224 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
225 | |||
226 | 'org' generates a report in the Org mode format of Emacs. | ||
227 | |||
228 | Example: | ||
229 | |||
230 | Running | ||
231 | make coccicheck MODE=org COCCI=scripts/coccinelle/err_cast.cocci | ||
232 | |||
233 | will execute the following part of the SmPL script. | ||
234 | |||
235 | <smpl> | ||
236 | @r depends on !context && !patch && (org || report)@ | ||
237 | expression x; | ||
238 | position p; | ||
239 | @@ | ||
240 | |||
241 | ERR_PTR@p(PTR_ERR(x)) | ||
242 | |||
243 | @script:python depends on org@ | ||
244 | p << r.p; | ||
245 | x << r.x; | ||
246 | @@ | ||
247 | |||
248 | msg="ERR_CAST can be used with %s" % (x) | ||
249 | msg_safe=msg.replace("[","@(").replace("]",")") | ||
250 | coccilib.org.print_todo(p[0], msg_safe) | ||
251 | </smpl> | ||
252 | |||
253 | This SmPL excerpt generates Org entries on the standard output, as | ||
254 | illustrated below: | ||
255 | |||
256 | * TODO [[view:/home/user/linux/crypto/ctr.c::face=ovl-face1::linb=188::colb=9::cole=16][ERR_CAST can be used with alg]] | ||
257 | * TODO [[view:/home/user/linux/crypto/authenc.c::face=ovl-face1::linb=619::colb=9::cole=16][ERR_CAST can be used with auth]] | ||
258 | * TODO [[view:/home/user/linux/crypto/xts.c::face=ovl-face1::linb=227::colb=9::cole=16][ERR_CAST can be used with alg]] | ||
diff --git a/MAINTAINERS b/MAINTAINERS index 05741e0da46c..11e34d5272b8 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -1569,6 +1569,16 @@ L: platform-driver-x86@vger.kernel.org | |||
1569 | S: Supported | 1569 | S: Supported |
1570 | F: drivers/platform/x86/classmate-laptop.c | 1570 | F: drivers/platform/x86/classmate-laptop.c |
1571 | 1571 | ||
1572 | COCCINELLE/Semantic Patches (SmPL) | ||
1573 | M: Julia Lawall <julia@diku.dk> | ||
1574 | M: Gilles Muller <Gilles.Muller@lip6.fr> | ||
1575 | M: Nicolas Palix <npalix@diku.dk> | ||
1576 | L: cocci@diku.dk (moderated for non-subscribers) | ||
1577 | W: http://coccinelle.lip6.fr/ | ||
1578 | S: Supported | ||
1579 | F: scripts/coccinelle/ | ||
1580 | F: scripts/coccicheck | ||
1581 | |||
1572 | CODA FILE SYSTEM | 1582 | CODA FILE SYSTEM |
1573 | M: Jan Harkes <jaharkes@cs.cmu.edu> | 1583 | M: Jan Harkes <jaharkes@cs.cmu.edu> |
1574 | M: coda@cs.cmu.edu | 1584 | M: coda@cs.cmu.edu |
@@ -3266,8 +3276,8 @@ F: fs/autofs4/ | |||
3266 | 3276 | ||
3267 | KERNEL BUILD + files below scripts/ (unless maintained elsewhere) | 3277 | KERNEL BUILD + files below scripts/ (unless maintained elsewhere) |
3268 | M: Michal Marek <mmarek@suse.cz> | 3278 | M: Michal Marek <mmarek@suse.cz> |
3269 | T: git git://repo.or.cz/linux-kbuild.git for-next | 3279 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6.git for-next |
3270 | T: git git://repo.or.cz/linux-kbuild.git for-linus | 3280 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6.git rc-fixes |
3271 | L: linux-kbuild@vger.kernel.org | 3281 | L: linux-kbuild@vger.kernel.org |
3272 | S: Maintained | 3282 | S: Maintained |
3273 | F: Documentation/kbuild/ | 3283 | F: Documentation/kbuild/ |
@@ -418,7 +418,7 @@ endif | |||
418 | # of make so .config is not included in this case either (for *config). | 418 | # of make so .config is not included in this case either (for *config). |
419 | 419 | ||
420 | no-dot-config-targets := clean mrproper distclean \ | 420 | no-dot-config-targets := clean mrproper distclean \ |
421 | cscope TAGS tags help %docs check% \ | 421 | cscope TAGS tags help %docs check% coccicheck \ |
422 | include/linux/version.h headers_% \ | 422 | include/linux/version.h headers_% \ |
423 | kernelversion | 423 | kernelversion |
424 | 424 | ||
@@ -532,7 +532,7 @@ endif # $(dot-config) | |||
532 | # The all: target is the default when no target is given on the | 532 | # The all: target is the default when no target is given on the |
533 | # command line. | 533 | # command line. |
534 | # This allow a user to issue only 'make' to build a kernel including modules | 534 | # This allow a user to issue only 'make' to build a kernel including modules |
535 | # Defaults vmlinux but it is usually overridden in the arch makefile | 535 | # Defaults to vmlinux, but the arch makefile usually adds further targets |
536 | all: vmlinux | 536 | all: vmlinux |
537 | 537 | ||
538 | ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE | 538 | ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE |
@@ -1219,8 +1219,9 @@ help: | |||
1219 | @echo ' includecheck - Check for duplicate included header files' | 1219 | @echo ' includecheck - Check for duplicate included header files' |
1220 | @echo ' export_report - List the usages of all exported symbols' | 1220 | @echo ' export_report - List the usages of all exported symbols' |
1221 | @echo ' headers_check - Sanity check on exported headers' | 1221 | @echo ' headers_check - Sanity check on exported headers' |
1222 | @echo ' headerdep - Detect inclusion cycles in headers'; \ | 1222 | @echo ' headerdep - Detect inclusion cycles in headers' |
1223 | echo '' | 1223 | @$(MAKE) -f $(srctree)/scripts/Makefile.help checker-help |
1224 | @echo '' | ||
1224 | @echo 'Kernel packaging:' | 1225 | @echo 'Kernel packaging:' |
1225 | @$(MAKE) $(build)=$(package-dir) help | 1226 | @$(MAKE) $(build)=$(package-dir) help |
1226 | @echo '' | 1227 | @echo '' |
@@ -1379,6 +1380,9 @@ versioncheck: | |||
1379 | -name '*.[hcS]' -type f -print | sort \ | 1380 | -name '*.[hcS]' -type f -print | sort \ |
1380 | | xargs $(PERL) -w $(srctree)/scripts/checkversion.pl | 1381 | | xargs $(PERL) -w $(srctree)/scripts/checkversion.pl |
1381 | 1382 | ||
1383 | coccicheck: | ||
1384 | $(Q)$(CONFIG_SHELL) $(srctree)/scripts/$@ | ||
1385 | |||
1382 | namespacecheck: | 1386 | namespacecheck: |
1383 | $(PERL) $(srctree)/scripts/namespace.pl | 1387 | $(PERL) $(srctree)/scripts/namespace.pl |
1384 | 1388 | ||
diff --git a/scripts/Makefile.help b/scripts/Makefile.help new file mode 100644 index 000000000000..d03608f5db04 --- /dev/null +++ b/scripts/Makefile.help | |||
@@ -0,0 +1,3 @@ | |||
1 | |||
2 | checker-help: | ||
3 | @echo ' coccicheck - Check with Coccinelle.' | ||
diff --git a/scripts/checkkconfigsymbols.sh b/scripts/checkkconfigsymbols.sh index 46be3c5a62b7..2ca49bb31efc 100755 --- a/scripts/checkkconfigsymbols.sh +++ b/scripts/checkkconfigsymbols.sh | |||
@@ -14,7 +14,7 @@ find $paths -name '*.[chS]' -o -name 'Makefile' -o -name 'Makefile*[^~]'| while | |||
14 | do | 14 | do |
15 | # Output the bare Kconfig variable and the filename; the _MODULE part at | 15 | # Output the bare Kconfig variable and the filename; the _MODULE part at |
16 | # the end is not removed here (would need perl an not-hungry regexp for that). | 16 | # the end is not removed here (would need perl an not-hungry regexp for that). |
17 | sed -ne 's!^.*\<\(UML_\)\?CONFIG_\([0-9A-Z_]\+\).*!\2 '$i'!p' < $i | 17 | sed -ne 's!^.*\<\(UML_\)\?CONFIG_\([0-9A-Za-z_]\+\).*!\2 '$i'!p' < $i |
18 | done | \ | 18 | done | \ |
19 | # Smart "sort|uniq" implemented in awk and tuned to collect the names of all | 19 | # Smart "sort|uniq" implemented in awk and tuned to collect the names of all |
20 | # files which use a given symbol | 20 | # files which use a given symbol |
diff --git a/scripts/coccicheck b/scripts/coccicheck new file mode 100755 index 000000000000..b8bcf1f7bed7 --- /dev/null +++ b/scripts/coccicheck | |||
@@ -0,0 +1,80 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | SPATCH="`which ${SPATCH:=spatch}`" | ||
4 | |||
5 | if [ "$C" = "1" -o "$C" = "2" ]; then | ||
6 | ONLINE=1 | ||
7 | |||
8 | # This requires Coccinelle >= 0.2.3 | ||
9 | # FLAGS="-ignore_unknown_options -very_quiet" | ||
10 | # OPTIONS=$* | ||
11 | |||
12 | # Workaround for Coccinelle < 0.2.3 | ||
13 | FLAGS="-I $srctree/include -very_quiet" | ||
14 | shift $(( $# - 1 )) | ||
15 | OPTIONS=$1 | ||
16 | else | ||
17 | ONLINE=0 | ||
18 | FLAGS="-very_quiet" | ||
19 | fi | ||
20 | |||
21 | if [ ! -x "$SPATCH" ]; then | ||
22 | echo 'spatch is part of the Coccinelle project and is available at http://coccinelle.lip6.fr/' | ||
23 | exit 1 | ||
24 | fi | ||
25 | |||
26 | if [ "$MODE" = "" ] ; then | ||
27 | if [ "$ONLINE" = "0" ] ; then | ||
28 | echo 'You have not explicitly specify the mode to use. Fallback to "report".' | ||
29 | echo 'You can specify the mode with "make coccicheck MODE=<mode>"' | ||
30 | echo 'Available modes are: report, patch, context, org' | ||
31 | fi | ||
32 | MODE="report" | ||
33 | fi | ||
34 | |||
35 | if [ "$ONLINE" = "0" ] ; then | ||
36 | echo '' | ||
37 | echo 'Please check for false positives in the output before submitting a patch.' | ||
38 | echo 'When using "patch" mode, carefully review the patch before submitting it.' | ||
39 | echo '' | ||
40 | fi | ||
41 | |||
42 | coccinelle () { | ||
43 | COCCI="$1" | ||
44 | |||
45 | OPT=`grep "Option" $COCCI | cut -d':' -f2` | ||
46 | |||
47 | # The option '-parse_cocci' can be used to syntaxically check the SmPL files. | ||
48 | # | ||
49 | # $SPATCH -D $MODE $FLAGS -parse_cocci $COCCI $OPT > /dev/null | ||
50 | |||
51 | if [ "$ONLINE" = "0" ] ; then | ||
52 | |||
53 | FILE=`echo $COCCI | sed "s|$srctree/||"` | ||
54 | |||
55 | echo "Processing `basename $COCCI` with option(s) \"$OPT\"" | ||
56 | echo 'Message example to submit a patch:' | ||
57 | |||
58 | sed -e '/\/\/\//!d' -e 's|^///||' $COCCI | ||
59 | |||
60 | echo ' The semantic patch that makes this change is available' | ||
61 | echo " in $FILE." | ||
62 | echo '' | ||
63 | echo ' More information about semantic patching is available at' | ||
64 | echo ' http://coccinelle.lip6.fr/' | ||
65 | echo '' | ||
66 | |||
67 | $SPATCH -D $MODE $FLAGS -sp_file $COCCI $OPT -dir $srctree || exit 1 | ||
68 | else | ||
69 | $SPATCH -D $MODE $FLAGS -sp_file $COCCI $OPT $OPTIONS || exit 1 | ||
70 | fi | ||
71 | |||
72 | } | ||
73 | |||
74 | if [ "$COCCI" = "" ] ; then | ||
75 | for f in `find $srctree/scripts/coccinelle/ -name '*.cocci' -type f | sort`; do | ||
76 | coccinelle $f | ||
77 | done | ||
78 | else | ||
79 | coccinelle $COCCI | ||
80 | fi | ||
diff --git a/scripts/coccinelle/alloc/drop_kmalloc_cast.cocci b/scripts/coccinelle/alloc/drop_kmalloc_cast.cocci new file mode 100644 index 000000000000..7d4771d449c3 --- /dev/null +++ b/scripts/coccinelle/alloc/drop_kmalloc_cast.cocci | |||
@@ -0,0 +1,67 @@ | |||
1 | /// | ||
2 | /// Casting (void *) value returned by kmalloc is useless | ||
3 | /// as mentioned in Documentation/CodingStyle, Chap 14. | ||
4 | /// | ||
5 | // Confidence: High | ||
6 | // Copyright: 2009,2010 Nicolas Palix, DIKU. GPLv2. | ||
7 | // URL: http://coccinelle.lip6.fr/ | ||
8 | // Options: -no_includes -include_headers | ||
9 | // | ||
10 | // Keywords: kmalloc, kzalloc, kcalloc | ||
11 | // Version min: < 2.6.12 kmalloc | ||
12 | // Version min: < 2.6.12 kcalloc | ||
13 | // Version min: 2.6.14 kzalloc | ||
14 | // | ||
15 | |||
16 | virtual context | ||
17 | virtual patch | ||
18 | virtual org | ||
19 | virtual report | ||
20 | |||
21 | //---------------------------------------------------------- | ||
22 | // For context mode | ||
23 | //---------------------------------------------------------- | ||
24 | |||
25 | @depends on context@ | ||
26 | type T; | ||
27 | @@ | ||
28 | |||
29 | * (T *) | ||
30 | \(kmalloc\|kzalloc\|kcalloc\)(...) | ||
31 | |||
32 | //---------------------------------------------------------- | ||
33 | // For patch mode | ||
34 | //---------------------------------------------------------- | ||
35 | |||
36 | @depends on patch@ | ||
37 | type T; | ||
38 | @@ | ||
39 | |||
40 | - (T *) | ||
41 | \(kmalloc\|kzalloc\|kcalloc\)(...) | ||
42 | |||
43 | //---------------------------------------------------------- | ||
44 | // For org and report mode | ||
45 | //---------------------------------------------------------- | ||
46 | |||
47 | @r depends on org || report@ | ||
48 | type T; | ||
49 | position p; | ||
50 | @@ | ||
51 | |||
52 | (T@p *)\(kmalloc\|kzalloc\|kcalloc\)(...) | ||
53 | |||
54 | @script:python depends on org@ | ||
55 | p << r.p; | ||
56 | t << r.T; | ||
57 | @@ | ||
58 | |||
59 | coccilib.org.print_safe_todo(p[0], t) | ||
60 | |||
61 | @script:python depends on report@ | ||
62 | p << r.p; | ||
63 | t << r.T; | ||
64 | @@ | ||
65 | |||
66 | msg="WARNING: casting value returned by k[cmz]alloc to (%s *) is useless." % (t) | ||
67 | coccilib.report.print_report(p[0], msg) | ||
diff --git a/scripts/coccinelle/alloc/kzalloc-simple.cocci b/scripts/coccinelle/alloc/kzalloc-simple.cocci new file mode 100644 index 000000000000..2eae828fc657 --- /dev/null +++ b/scripts/coccinelle/alloc/kzalloc-simple.cocci | |||
@@ -0,0 +1,82 @@ | |||
1 | /// | ||
2 | /// kzalloc should be used rather than kmalloc followed by memset 0 | ||
3 | /// | ||
4 | // Confidence: High | ||
5 | // Copyright: (C) 2009-2010 Julia Lawall, Nicolas Palix, DIKU. GPLv2. | ||
6 | // Copyright: (C) 2009-2010 Gilles Muller, INRIA/LiP6. GPLv2. | ||
7 | // URL: http://coccinelle.lip6.fr/rules/kzalloc.html | ||
8 | // Options: -no_includes -include_headers | ||
9 | // | ||
10 | // Keywords: kmalloc, kzalloc | ||
11 | // Version min: < 2.6.12 kmalloc | ||
12 | // Version min: 2.6.14 kzalloc | ||
13 | // | ||
14 | |||
15 | virtual context | ||
16 | virtual patch | ||
17 | virtual org | ||
18 | virtual report | ||
19 | |||
20 | //---------------------------------------------------------- | ||
21 | // For context mode | ||
22 | //---------------------------------------------------------- | ||
23 | |||
24 | @depends on context@ | ||
25 | type T, T2; | ||
26 | expression x; | ||
27 | expression E1,E2; | ||
28 | statement S; | ||
29 | @@ | ||
30 | |||
31 | * x = (T)kmalloc(E1,E2); | ||
32 | if ((x==NULL) || ...) S | ||
33 | * memset((T2)x,0,E1); | ||
34 | |||
35 | //---------------------------------------------------------- | ||
36 | // For patch mode | ||
37 | //---------------------------------------------------------- | ||
38 | |||
39 | @depends on patch@ | ||
40 | type T, T2; | ||
41 | expression x; | ||
42 | expression E1,E2; | ||
43 | statement S; | ||
44 | @@ | ||
45 | |||
46 | - x = (T)kmalloc(E1,E2); | ||
47 | + x = kzalloc(E1,E2); | ||
48 | if ((x==NULL) || ...) S | ||
49 | - memset((T2)x,0,E1); | ||
50 | |||
51 | //---------------------------------------------------------- | ||
52 | // For org mode | ||
53 | //---------------------------------------------------------- | ||
54 | |||
55 | @r depends on org || report@ | ||
56 | type T, T2; | ||
57 | expression x; | ||
58 | expression E1,E2; | ||
59 | statement S; | ||
60 | position p; | ||
61 | @@ | ||
62 | |||
63 | x = (T)kmalloc@p(E1,E2); | ||
64 | if ((x==NULL) || ...) S | ||
65 | memset((T2)x,0,E1); | ||
66 | |||
67 | @script:python depends on org@ | ||
68 | p << r.p; | ||
69 | x << r.x; | ||
70 | @@ | ||
71 | |||
72 | msg="%s" % (x) | ||
73 | msg_safe=msg.replace("[","@(").replace("]",")") | ||
74 | coccilib.org.print_todo(p[0], msg_safe) | ||
75 | |||
76 | @script:python depends on report@ | ||
77 | p << r.p; | ||
78 | x << r.x; | ||
79 | @@ | ||
80 | |||
81 | msg="WARNING: kzalloc should be used for %s, instead of kmalloc/memset" % (x) | ||
82 | coccilib.report.print_report(p[0], msg) | ||
diff --git a/scripts/coccinelle/deref_null.cocci b/scripts/coccinelle/deref_null.cocci new file mode 100644 index 000000000000..9969d76d0f4b --- /dev/null +++ b/scripts/coccinelle/deref_null.cocci | |||
@@ -0,0 +1,293 @@ | |||
1 | /// | ||
2 | /// A variable is dereference under a NULL test. | ||
3 | /// Even though it is know to be NULL. | ||
4 | /// | ||
5 | // Confidence: Moderate | ||
6 | // Copyright: (C) 2010 Nicolas Palix, DIKU. GPLv2. | ||
7 | // Copyright: (C) 2010 Julia Lawall, DIKU. GPLv2. | ||
8 | // Copyright: (C) 2010 Gilles Muller, INRIA/LiP6. GPLv2. | ||
9 | // URL: http://coccinelle.lip6.fr/ | ||
10 | // Comments: -I ... -all_includes can give more complete results | ||
11 | // Options: | ||
12 | |||
13 | virtual context | ||
14 | virtual patch | ||
15 | virtual org | ||
16 | virtual report | ||
17 | |||
18 | @initialize:python depends on !context && patch && !org && !report@ | ||
19 | |||
20 | import sys | ||
21 | print >> sys.stderr, "This semantic patch does not support the 'patch' mode." | ||
22 | |||
23 | @depends on patch@ | ||
24 | @@ | ||
25 | |||
26 | this_rule_should_never_matches(); | ||
27 | |||
28 | @ifm depends on !patch@ | ||
29 | expression *E; | ||
30 | statement S1,S2; | ||
31 | position p1; | ||
32 | @@ | ||
33 | |||
34 | if@p1 ((E == NULL && ...) || ...) S1 else S2 | ||
35 | |||
36 | // The following two rules are separate, because both can match a single | ||
37 | // expression in different ways | ||
38 | @pr1 depends on !patch expression@ | ||
39 | expression *ifm.E; | ||
40 | identifier f; | ||
41 | position p1; | ||
42 | @@ | ||
43 | |||
44 | (E != NULL && ...) ? <+...E->f@p1...+> : ... | ||
45 | |||
46 | @pr2 depends on !patch expression@ | ||
47 | expression *ifm.E; | ||
48 | identifier f; | ||
49 | position p2; | ||
50 | @@ | ||
51 | |||
52 | ( | ||
53 | (E != NULL) && ... && <+...E->f@p2...+> | ||
54 | | | ||
55 | (E == NULL) || ... || <+...E->f@p2...+> | ||
56 | | | ||
57 | sizeof(<+...E->f@p2...+>) | ||
58 | ) | ||
59 | |||
60 | // For org and report modes | ||
61 | |||
62 | @r depends on !context && !patch && (org || report) exists@ | ||
63 | expression subE <= ifm.E; | ||
64 | expression *ifm.E; | ||
65 | expression E1,E2; | ||
66 | identifier f; | ||
67 | statement S1,S2,S3,S4; | ||
68 | iterator iter; | ||
69 | position p!={pr1.p1,pr2.p2}; | ||
70 | position ifm.p1; | ||
71 | @@ | ||
72 | |||
73 | if@p1 ((E == NULL && ...) || ...) | ||
74 | { | ||
75 | ... when != if (...) S1 else S2 | ||
76 | ( | ||
77 | iter(subE,...) S4 // no use | ||
78 | | | ||
79 | list_remove_head(E2,subE,...) | ||
80 | | | ||
81 | subE = E1 | ||
82 | | | ||
83 | for(subE = E1;...;...) S4 | ||
84 | | | ||
85 | subE++ | ||
86 | | | ||
87 | ++subE | ||
88 | | | ||
89 | --subE | ||
90 | | | ||
91 | subE-- | ||
92 | | | ||
93 | &subE | ||
94 | | | ||
95 | E->f@p // bad use | ||
96 | ) | ||
97 | ... when any | ||
98 | return ...; | ||
99 | } | ||
100 | else S3 | ||
101 | |||
102 | @script:python depends on !context && !patch && !org && report@ | ||
103 | p << r.p; | ||
104 | p1 << ifm.p1; | ||
105 | x << ifm.E; | ||
106 | @@ | ||
107 | |||
108 | msg="ERROR: %s is NULL but dereferenced." % (x) | ||
109 | coccilib.report.print_report(p[0], msg) | ||
110 | cocci.include_match(False) | ||
111 | |||
112 | @script:python depends on !context && !patch && org && !report@ | ||
113 | p << r.p; | ||
114 | p1 << ifm.p1; | ||
115 | x << ifm.E; | ||
116 | @@ | ||
117 | |||
118 | msg="ERROR: %s is NULL but dereferenced." % (x) | ||
119 | msg_safe=msg.replace("[","@(").replace("]",")") | ||
120 | cocci.print_main(msg_safe,p) | ||
121 | cocci.include_match(False) | ||
122 | |||
123 | @s depends on !context && !patch && (org || report) exists@ | ||
124 | expression subE <= ifm.E; | ||
125 | expression *ifm.E; | ||
126 | expression E1,E2; | ||
127 | identifier f; | ||
128 | statement S1,S2,S3,S4; | ||
129 | iterator iter; | ||
130 | position p!={pr1.p1,pr2.p2}; | ||
131 | position ifm.p1; | ||
132 | @@ | ||
133 | |||
134 | if@p1 ((E == NULL && ...) || ...) | ||
135 | { | ||
136 | ... when != if (...) S1 else S2 | ||
137 | ( | ||
138 | iter(subE,...) S4 // no use | ||
139 | | | ||
140 | list_remove_head(E2,subE,...) | ||
141 | | | ||
142 | subE = E1 | ||
143 | | | ||
144 | for(subE = E1;...;...) S4 | ||
145 | | | ||
146 | subE++ | ||
147 | | | ||
148 | ++subE | ||
149 | | | ||
150 | --subE | ||
151 | | | ||
152 | subE-- | ||
153 | | | ||
154 | &subE | ||
155 | | | ||
156 | E->f@p // bad use | ||
157 | ) | ||
158 | ... when any | ||
159 | } | ||
160 | else S3 | ||
161 | |||
162 | @script:python depends on !context && !patch && !org && report@ | ||
163 | p << s.p; | ||
164 | p1 << ifm.p1; | ||
165 | x << ifm.E; | ||
166 | @@ | ||
167 | |||
168 | msg="ERROR: %s is NULL but dereferenced." % (x) | ||
169 | coccilib.report.print_report(p[0], msg) | ||
170 | |||
171 | @script:python depends on !context && !patch && org && !report@ | ||
172 | p << s.p; | ||
173 | p1 << ifm.p1; | ||
174 | x << ifm.E; | ||
175 | @@ | ||
176 | |||
177 | msg="ERROR: %s is NULL but dereferenced." % (x) | ||
178 | msg_safe=msg.replace("[","@(").replace("]",")") | ||
179 | cocci.print_main(msg_safe,p) | ||
180 | |||
181 | // For context mode | ||
182 | |||
183 | @depends on context && !patch && !org && !report exists@ | ||
184 | expression subE <= ifm.E; | ||
185 | expression *ifm.E; | ||
186 | expression E1,E2; | ||
187 | identifier f; | ||
188 | statement S1,S2,S3,S4; | ||
189 | iterator iter; | ||
190 | position p!={pr1.p1,pr2.p2}; | ||
191 | position ifm.p1; | ||
192 | @@ | ||
193 | |||
194 | if@p1 ((E == NULL && ...) || ...) | ||
195 | { | ||
196 | ... when != if (...) S1 else S2 | ||
197 | ( | ||
198 | iter(subE,...) S4 // no use | ||
199 | | | ||
200 | list_remove_head(E2,subE,...) | ||
201 | | | ||
202 | subE = E1 | ||
203 | | | ||
204 | for(subE = E1;...;...) S4 | ||
205 | | | ||
206 | subE++ | ||
207 | | | ||
208 | ++subE | ||
209 | | | ||
210 | --subE | ||
211 | | | ||
212 | subE-- | ||
213 | | | ||
214 | &subE | ||
215 | | | ||
216 | * E->f@p // bad use | ||
217 | ) | ||
218 | ... when any | ||
219 | return ...; | ||
220 | } | ||
221 | else S3 | ||
222 | |||
223 | // The following three rules are duplicates of ifm, pr1 and pr2 respectively. | ||
224 | // It is need because the previous rule as already made a "change". | ||
225 | |||
226 | @ifm1 depends on !patch@ | ||
227 | expression *E; | ||
228 | statement S1,S2; | ||
229 | position p1; | ||
230 | @@ | ||
231 | |||
232 | if@p1 ((E == NULL && ...) || ...) S1 else S2 | ||
233 | |||
234 | @pr11 depends on !patch expression@ | ||
235 | expression *ifm1.E; | ||
236 | identifier f; | ||
237 | position p1; | ||
238 | @@ | ||
239 | |||
240 | (E != NULL && ...) ? <+...E->f@p1...+> : ... | ||
241 | |||
242 | @pr12 depends on !patch expression@ | ||
243 | expression *ifm1.E; | ||
244 | identifier f; | ||
245 | position p2; | ||
246 | @@ | ||
247 | |||
248 | ( | ||
249 | (E != NULL) && ... && <+...E->f@p2...+> | ||
250 | | | ||
251 | (E == NULL) || ... || <+...E->f@p2...+> | ||
252 | | | ||
253 | sizeof(<+...E->f@p2...+>) | ||
254 | ) | ||
255 | |||
256 | @depends on context && !patch && !org && !report exists@ | ||
257 | expression subE <= ifm1.E; | ||
258 | expression *ifm1.E; | ||
259 | expression E1,E2; | ||
260 | identifier f; | ||
261 | statement S1,S2,S3,S4; | ||
262 | iterator iter; | ||
263 | position p!={pr11.p1,pr12.p2}; | ||
264 | position ifm1.p1; | ||
265 | @@ | ||
266 | |||
267 | if@p1 ((E == NULL && ...) || ...) | ||
268 | { | ||
269 | ... when != if (...) S1 else S2 | ||
270 | ( | ||
271 | iter(subE,...) S4 // no use | ||
272 | | | ||
273 | list_remove_head(E2,subE,...) | ||
274 | | | ||
275 | subE = E1 | ||
276 | | | ||
277 | for(subE = E1;...;...) S4 | ||
278 | | | ||
279 | subE++ | ||
280 | | | ||
281 | ++subE | ||
282 | | | ||
283 | --subE | ||
284 | | | ||
285 | subE-- | ||
286 | | | ||
287 | &subE | ||
288 | | | ||
289 | * E->f@p // bad use | ||
290 | ) | ||
291 | ... when any | ||
292 | } | ||
293 | else S3 | ||
diff --git a/scripts/coccinelle/err_cast.cocci b/scripts/coccinelle/err_cast.cocci new file mode 100644 index 000000000000..2ce115000af6 --- /dev/null +++ b/scripts/coccinelle/err_cast.cocci | |||
@@ -0,0 +1,56 @@ | |||
1 | /// | ||
2 | /// Use ERR_CAST inlined function instead of ERR_PTR(PTR_ERR(...)) | ||
3 | /// | ||
4 | // Confidence: High | ||
5 | // Copyright: (C) 2009, 2010 Nicolas Palix, DIKU. GPLv2. | ||
6 | // Copyright: (C) 2009, 2010 Julia Lawall, DIKU. GPLv2. | ||
7 | // Copyright: (C) 2009, 2010 Gilles Muller, INRIA/LiP6. GPLv2. | ||
8 | // URL: http://coccinelle.lip6.fr/ | ||
9 | // Options: | ||
10 | // | ||
11 | // Keywords: ERR_PTR, PTR_ERR, ERR_CAST | ||
12 | // Version min: 2.6.25 | ||
13 | // | ||
14 | |||
15 | virtual context | ||
16 | virtual patch | ||
17 | virtual org | ||
18 | virtual report | ||
19 | |||
20 | |||
21 | @ depends on context && !patch && !org && !report@ | ||
22 | expression x; | ||
23 | @@ | ||
24 | |||
25 | * ERR_PTR(PTR_ERR(x)) | ||
26 | |||
27 | @ depends on !context && patch && !org && !report @ | ||
28 | expression x; | ||
29 | @@ | ||
30 | |||
31 | - ERR_PTR(PTR_ERR(x)) | ||
32 | + ERR_CAST(x) | ||
33 | |||
34 | @r depends on !context && !patch && (org || report)@ | ||
35 | expression x; | ||
36 | position p; | ||
37 | @@ | ||
38 | |||
39 | ERR_PTR@p(PTR_ERR(x)) | ||
40 | |||
41 | @script:python depends on org@ | ||
42 | p << r.p; | ||
43 | x << r.x; | ||
44 | @@ | ||
45 | |||
46 | msg="WARNING ERR_CAST can be used with %s" % (x) | ||
47 | msg_safe=msg.replace("[","@(").replace("]",")") | ||
48 | coccilib.org.print_todo(p[0], msg_safe) | ||
49 | |||
50 | @script:python depends on report@ | ||
51 | p << r.p; | ||
52 | x << r.x; | ||
53 | @@ | ||
54 | |||
55 | msg="WARNING: ERR_CAST can be used with %s" % (x) | ||
56 | coccilib.report.print_report(p[0], msg) | ||
diff --git a/scripts/coccinelle/resource_size.cocci b/scripts/coccinelle/resource_size.cocci new file mode 100644 index 000000000000..1935a58b39d9 --- /dev/null +++ b/scripts/coccinelle/resource_size.cocci | |||
@@ -0,0 +1,93 @@ | |||
1 | /// | ||
2 | /// Use resource_size function on resource object | ||
3 | /// instead of explicit computation. | ||
4 | /// | ||
5 | // Confidence: High | ||
6 | // Copyright: (C) 2009, 2010 Nicolas Palix, DIKU. GPLv2. | ||
7 | // Copyright: (C) 2009, 2010 Julia Lawall, DIKU. GPLv2. | ||
8 | // Copyright: (C) 2009, 2010 Gilles Muller, INRIA/LiP6. GPLv2. | ||
9 | // URL: http://coccinelle.lip6.fr/ | ||
10 | // Options: | ||
11 | // | ||
12 | // Keywords: resource_size | ||
13 | // Version min: 2.6.27 resource_size | ||
14 | // | ||
15 | |||
16 | virtual context | ||
17 | virtual patch | ||
18 | virtual org | ||
19 | virtual report | ||
20 | |||
21 | //---------------------------------------------------------- | ||
22 | // For context mode | ||
23 | //---------------------------------------------------------- | ||
24 | |||
25 | @r_context depends on context && !patch && !org@ | ||
26 | struct resource *res; | ||
27 | @@ | ||
28 | |||
29 | * (res->end - res->start) + 1 | ||
30 | |||
31 | //---------------------------------------------------------- | ||
32 | // For patch mode | ||
33 | //---------------------------------------------------------- | ||
34 | |||
35 | @r_patch depends on !context && patch && !org@ | ||
36 | struct resource *res; | ||
37 | @@ | ||
38 | |||
39 | - (res->end - res->start) + 1 | ||
40 | + resource_size(res) | ||
41 | |||
42 | //---------------------------------------------------------- | ||
43 | // For org mode | ||
44 | //---------------------------------------------------------- | ||
45 | |||
46 | |||
47 | @r_org depends on !context && !patch && (org || report)@ | ||
48 | struct resource *res; | ||
49 | position p; | ||
50 | @@ | ||
51 | |||
52 | (res->end@p - res->start) + 1 | ||
53 | |||
54 | @rbad_org depends on !context && !patch && (org || report)@ | ||
55 | struct resource *res; | ||
56 | position p != r_org.p; | ||
57 | @@ | ||
58 | |||
59 | res->end@p - res->start | ||
60 | |||
61 | @script:python depends on org@ | ||
62 | p << r_org.p; | ||
63 | x << r_org.res; | ||
64 | @@ | ||
65 | |||
66 | msg="ERROR with %s" % (x) | ||
67 | msg_safe=msg.replace("[","@(").replace("]",")") | ||
68 | coccilib.org.print_todo(p[0], msg_safe) | ||
69 | |||
70 | @script:python depends on report@ | ||
71 | p << r_org.p; | ||
72 | x << r_org.res; | ||
73 | @@ | ||
74 | |||
75 | msg="ERROR: Missing resource_size with %s" % (x) | ||
76 | coccilib.report.print_report(p[0], msg) | ||
77 | |||
78 | @script:python depends on org@ | ||
79 | p << rbad_org.p; | ||
80 | x << rbad_org.res; | ||
81 | @@ | ||
82 | |||
83 | msg="WARNING with %s" % (x) | ||
84 | msg_safe=msg.replace("[","@(").replace("]",")") | ||
85 | coccilib.org.print_todo(p[0], msg_safe) | ||
86 | |||
87 | @script:python depends on report@ | ||
88 | p << rbad_org.p; | ||
89 | x << rbad_org.res; | ||
90 | @@ | ||
91 | |||
92 | msg="WARNING: Suspicious code. resource_size is maybe missing with %s" % (x) | ||
93 | coccilib.report.print_report(p[0], msg) | ||
diff --git a/scripts/decodecode b/scripts/decodecode index 8b30cc36744f..18ba881c3415 100755 --- a/scripts/decodecode +++ b/scripts/decodecode | |||
@@ -40,7 +40,7 @@ echo $code | |||
40 | code=`echo $code | sed -e 's/.*Code: //'` | 40 | code=`echo $code | sed -e 's/.*Code: //'` |
41 | 41 | ||
42 | width=`expr index "$code" ' '` | 42 | width=`expr index "$code" ' '` |
43 | width=$[($width-1)/2] | 43 | width=$((($width-1)/2)) |
44 | case $width in | 44 | case $width in |
45 | 1) type=byte ;; | 45 | 1) type=byte ;; |
46 | 2) type=2byte ;; | 46 | 2) type=2byte ;; |
@@ -48,10 +48,10 @@ case $width in | |||
48 | esac | 48 | esac |
49 | 49 | ||
50 | disas() { | 50 | disas() { |
51 | ${CROSS_COMPILE}as $AFLAGS -o $1.o $1.s &> /dev/null | 51 | ${CROSS_COMPILE}as $AFLAGS -o $1.o $1.s > /dev/null 2>&1 |
52 | 52 | ||
53 | if [ "$ARCH" == "arm" ]; then | 53 | if [ "$ARCH" = "arm" ]; then |
54 | if [ $width == 2 ]; then | 54 | if [ $width -eq 2 ]; then |
55 | OBJDUMPFLAGS="-M force-thumb" | 55 | OBJDUMPFLAGS="-M force-thumb" |
56 | fi | 56 | fi |
57 | 57 | ||
@@ -59,7 +59,7 @@ disas() { | |||
59 | fi | 59 | fi |
60 | 60 | ||
61 | ${CROSS_COMPILE}objdump $OBJDUMPFLAGS -S $1.o | \ | 61 | ${CROSS_COMPILE}objdump $OBJDUMPFLAGS -S $1.o | \ |
62 | grep -v "/tmp\|Disassembly\|\.text\|^$" &> $1.dis | 62 | grep -v "/tmp\|Disassembly\|\.text\|^$" > $1.dis 2>&1 |
63 | } | 63 | } |
64 | 64 | ||
65 | marker=`expr index "$code" "\<"` | 65 | marker=`expr index "$code" "\<"` |
diff --git a/scripts/dtc/fstree.c b/scripts/dtc/fstree.c index 766b2694d935..8fe1bdf239f0 100644 --- a/scripts/dtc/fstree.c +++ b/scripts/dtc/fstree.c | |||
@@ -77,6 +77,7 @@ static struct node *read_fstree(const char *dirname) | |||
77 | free(tmpnam); | 77 | free(tmpnam); |
78 | } | 78 | } |
79 | 79 | ||
80 | closedir(d); | ||
80 | return tree; | 81 | return tree; |
81 | } | 82 | } |
82 | 83 | ||
diff --git a/scripts/kconfig/.gitignore b/scripts/kconfig/.gitignore index 6a36a76e6606..624f6502e03e 100644 --- a/scripts/kconfig/.gitignore +++ b/scripts/kconfig/.gitignore | |||
@@ -17,6 +17,7 @@ gconf.glade.h | |||
17 | # | 17 | # |
18 | conf | 18 | conf |
19 | mconf | 19 | mconf |
20 | nconf | ||
20 | qconf | 21 | qconf |
21 | gconf | 22 | gconf |
22 | kxgettext | 23 | kxgettext |