aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-07-30 14:23:37 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-07-30 14:23:37 -0400
commitf6774cbcad7aa21ac0d4fc92a5e4deae901f6534 (patch)
tree94c9647bf7cbaf94c535c4ffc749c50ad6615936 /scripts
parentb4e2ed325560a009d8508ff933f4df906fa96775 (diff)
parent1fa850596dcbc1b147948c832eb770d96c78024e (diff)
Merge branch 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild
Pull misc kbuild changes from Michal Marek: "This is the non-critical part of kbuild for v3.6-rc1: - Two new coccinelle semantic patches - New scripts/tags.sh regexp - scripts/config improvements that I mistakenly applied here instead of in the kconfig branch (but there are no conflicts) - Debian packaging fixes" * 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild: scripts/tags.sh: Teach [ce]tags about libtraceeevent error codes scripts/coccinelle: list iterator variable semantic patch scripts/coccinelle: Find threaded IRQs requests which are missing IRQF_ONESHOT deb-pkg: Add all Makefiles to header package deb-pkg: Install linux-firmware-image in versioned dir scripts/config: add option to undef a symbol scripts/config: allow alternate prefix to config option symbol scripts/config: add option to not upper-case symbols
Diffstat (limited to 'scripts')
-rw-r--r--scripts/coccinelle/iterators/use_after_iter.cocci147
-rw-r--r--scripts/coccinelle/misc/irqf_oneshot.cocci65
-rwxr-xr-xscripts/config60
-rw-r--r--scripts/package/builddeb7
-rwxr-xr-xscripts/tags.sh6
5 files changed, 264 insertions, 21 deletions
diff --git a/scripts/coccinelle/iterators/use_after_iter.cocci b/scripts/coccinelle/iterators/use_after_iter.cocci
new file mode 100644
index 000000000000..06284c57a951
--- /dev/null
+++ b/scripts/coccinelle/iterators/use_after_iter.cocci
@@ -0,0 +1,147 @@
1/// If list_for_each_entry, etc complete a traversal of the list, the iterator
2/// variable ends up pointing to an address at an offset from the list head,
3/// and not a meaningful structure. Thus this value should not be used after
4/// the end of the iterator.
5//#False positives arise when there is a goto in the iterator and the
6//#reported reference is at the label of this goto. Some flag tests
7//#may also cause a report to be a false positive.
8///
9// Confidence: Moderate
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: -no_includes -include_headers
15
16virtual context
17virtual org
18virtual report
19
20@r exists@
21identifier c,member;
22expression E,x;
23iterator name list_for_each_entry;
24iterator name list_for_each_entry_reverse;
25iterator name list_for_each_entry_continue;
26iterator name list_for_each_entry_continue_reverse;
27iterator name list_for_each_entry_from;
28iterator name list_for_each_entry_safe;
29iterator name list_for_each_entry_safe_continue;
30iterator name list_for_each_entry_safe_from;
31iterator name list_for_each_entry_safe_reverse;
32iterator name hlist_for_each_entry;
33iterator name hlist_for_each_entry_continue;
34iterator name hlist_for_each_entry_from;
35iterator name hlist_for_each_entry_safe;
36statement S;
37position p1,p2;
38@@
39
40(
41list_for_each_entry@p1(c,...,member) { ... when != break;
42 when forall
43 when strict
44}
45|
46list_for_each_entry_reverse@p1(c,...,member) { ... when != break;
47 when forall
48 when strict
49}
50|
51list_for_each_entry_continue@p1(c,...,member) { ... when != break;
52 when forall
53 when strict
54}
55|
56list_for_each_entry_continue_reverse@p1(c,...,member) { ... when != break;
57 when forall
58 when strict
59}
60|
61list_for_each_entry_from@p1(c,...,member) { ... when != break;
62 when forall
63 when strict
64}
65|
66list_for_each_entry_safe@p1(c,...,member) { ... when != break;
67 when forall
68 when strict
69}
70|
71list_for_each_entry_safe_continue@p1(c,...,member) { ... when != break;
72 when forall
73 when strict
74}
75|
76list_for_each_entry_safe_from@p1(c,...,member) { ... when != break;
77 when forall
78 when strict
79}
80|
81list_for_each_entry_safe_reverse@p1(c,...,member) { ... when != break;
82 when forall
83 when strict
84}
85)
86...
87(
88list_for_each_entry(c,...) S
89|
90list_for_each_entry_reverse(c,...) S
91|
92list_for_each_entry_continue(c,...) S
93|
94list_for_each_entry_continue_reverse(c,...) S
95|
96list_for_each_entry_from(c,...) S
97|
98list_for_each_entry_safe(c,...) S
99|
100list_for_each_entry_safe(x,c,...) S
101|
102list_for_each_entry_safe_continue(c,...) S
103|
104list_for_each_entry_safe_continue(x,c,...) S
105|
106list_for_each_entry_safe_from(c,...) S
107|
108list_for_each_entry_safe_from(x,c,...) S
109|
110list_for_each_entry_safe_reverse(c,...) S
111|
112list_for_each_entry_safe_reverse(x,c,...) S
113|
114hlist_for_each_entry(c,...) S
115|
116hlist_for_each_entry_continue(c,...) S
117|
118hlist_for_each_entry_from(c,...) S
119|
120hlist_for_each_entry_safe(c,...) S
121|
122list_remove_head(x,c,...)
123|
124sizeof(<+...c...+>)
125|
126&c->member
127|
128c = E
129|
130*c@p2
131)
132
133@script:python depends on org@
134p1 << r.p1;
135p2 << r.p2;
136@@
137
138cocci.print_main("invalid iterator index reference",p2)
139cocci.print_secs("iterator",p1)
140
141@script:python depends on report@
142p1 << r.p1;
143p2 << r.p2;
144@@
145
146msg = "ERROR: invalid reference to the index variable of the iterator on line %s" % (p1[0].line)
147coccilib.report.print_report(p2[0], msg)
diff --git a/scripts/coccinelle/misc/irqf_oneshot.cocci b/scripts/coccinelle/misc/irqf_oneshot.cocci
new file mode 100644
index 000000000000..6cfde94be0ef
--- /dev/null
+++ b/scripts/coccinelle/misc/irqf_oneshot.cocci
@@ -0,0 +1,65 @@
1/// Make sure threaded IRQs without a primary handler are always request with
2/// IRQF_ONESHOT
3///
4//
5// Confidence: Good
6// Comments:
7// Options: --no-includes
8
9virtual patch
10virtual context
11virtual org
12virtual report
13
14@r1@
15expression irq;
16expression thread_fn;
17expression flags;
18position p;
19@@
20request_threaded_irq@p(irq, NULL, thread_fn,
21(
22flags | IRQF_ONESHOT
23|
24IRQF_ONESHOT
25)
26, ...)
27
28@depends on patch@
29expression irq;
30expression thread_fn;
31expression flags;
32position p != r1.p;
33@@
34request_threaded_irq@p(irq, NULL, thread_fn,
35(
36-0
37+IRQF_ONESHOT
38|
39-flags
40+flags | IRQF_ONESHOT
41)
42, ...)
43
44@depends on context@
45position p != r1.p;
46@@
47*request_threaded_irq@p(...)
48
49@match depends on report || org@
50expression irq;
51position p != r1.p;
52@@
53request_threaded_irq@p(irq, NULL, ...)
54
55@script:python depends on org@
56p << match.p;
57@@
58msg = "ERROR: Threaded IRQ with no primary handler requested without IRQF_ONESHOT"
59coccilib.org.print_todo(p[0],msg)
60
61@script:python depends on report@
62p << match.p;
63@@
64msg = "ERROR: Threaded IRQ with no primary handler requested without IRQF_ONESHOT"
65coccilib.report.print_report(p[0],msg)
diff --git a/scripts/config b/scripts/config
index 9e984bc96e18..ee355394f4ef 100755
--- a/scripts/config
+++ b/scripts/config
@@ -1,6 +1,9 @@
1#!/bin/bash 1#!/bin/bash
2# Manipulate options in a .config file from the command line 2# Manipulate options in a .config file from the command line
3 3
4# If no prefix forced, use the default CONFIG_
5CONFIG_="${CONFIG_-CONFIG_}"
6
4usage() { 7usage() {
5 cat >&2 <<EOL 8 cat >&2 <<EOL
6Manipulate options in a .config file from the command line. 9Manipulate options in a .config file from the command line.
@@ -14,6 +17,7 @@ commands:
14 Set option to "string" 17 Set option to "string"
15 --set-val option value 18 --set-val option value
16 Set option to value 19 Set option to value
20 --undefine|-u option Undefine option
17 --state|-s option Print state of option (n,y,m,undef) 21 --state|-s option Print state of option (n,y,m,undef)
18 22
19 --enable-after|-E beforeopt option 23 --enable-after|-E beforeopt option
@@ -26,10 +30,17 @@ commands:
26 commands can be repeated multiple times 30 commands can be repeated multiple times
27 31
28options: 32options:
29 --file .config file to change (default .config) 33 --file config-file .config file to change (default .config)
34 --keep-case|-k Keep next symbols' case (dont' upper-case it)
30 35
31config doesn't check the validity of the .config file. This is done at next 36config doesn't check the validity of the .config file. This is done at next
32 make time. 37make time.
38
39By default, config will upper-case the given symbol. Use --keep-case to keep
40the case of all following symbols unchanged.
41
42config uses 'CONFIG_' as the default symbol prefix. Set the environment
43variable CONFIG_ to the prefix to use. Eg.: CONFIG_="FOO_" config ...
33EOL 44EOL
34 exit 1 45 exit 1
35} 46}
@@ -40,11 +51,13 @@ checkarg() {
40 usage 51 usage
41 fi 52 fi
42 case "$ARG" in 53 case "$ARG" in
43 CONFIG_*) 54 ${CONFIG_}*)
44 ARG="${ARG/CONFIG_/}" 55 ARG="${ARG/${CONFIG_}/}"
45 ;; 56 ;;
46 esac 57 esac
47 ARG="`echo $ARG | tr a-z A-Z`" 58 if [ "$MUNGE_CASE" = "yes" ] ; then
59 ARG="`echo $ARG | tr a-z A-Z`"
60 fi
48} 61}
49 62
50set_var() { 63set_var() {
@@ -61,6 +74,12 @@ set_var() {
61 fi 74 fi
62} 75}
63 76
77undef_var() {
78 local name=$1
79
80 sed -ri "/^($name=|# $name is not set)/d" "$FN"
81}
82
64if [ "$1" = "--file" ]; then 83if [ "$1" = "--file" ]; then
65 FN="$2" 84 FN="$2"
66 if [ "$FN" = "" ] ; then 85 if [ "$FN" = "" ] ; then
@@ -75,10 +94,16 @@ if [ "$1" = "" ] ; then
75 usage 94 usage
76fi 95fi
77 96
97MUNGE_CASE=yes
78while [ "$1" != "" ] ; do 98while [ "$1" != "" ] ; do
79 CMD="$1" 99 CMD="$1"
80 shift 100 shift
81 case "$CMD" in 101 case "$CMD" in
102 --keep-case|-k)
103 MUNGE_CASE=no
104 shift
105 continue
106 ;;
82 --refresh) 107 --refresh)
83 ;; 108 ;;
84 --*-after) 109 --*-after)
@@ -95,37 +120,40 @@ while [ "$1" != "" ] ; do
95 esac 120 esac
96 case "$CMD" in 121 case "$CMD" in
97 --enable|-e) 122 --enable|-e)
98 set_var "CONFIG_$ARG" "CONFIG_$ARG=y" 123 set_var "${CONFIG_}$ARG" "${CONFIG_}$ARG=y"
99 ;; 124 ;;
100 125
101 --disable|-d) 126 --disable|-d)
102 set_var "CONFIG_$ARG" "# CONFIG_$ARG is not set" 127 set_var "${CONFIG_}$ARG" "# ${CONFIG_}$ARG is not set"
103 ;; 128 ;;
104 129
105 --module|-m) 130 --module|-m)
106 set_var "CONFIG_$ARG" "CONFIG_$ARG=m" 131 set_var "${CONFIG_}$ARG" "${CONFIG_}$ARG=m"
107 ;; 132 ;;
108 133
109 --set-str) 134 --set-str)
110 # sed swallows one level of escaping, so we need double-escaping 135 # sed swallows one level of escaping, so we need double-escaping
111 set_var "CONFIG_$ARG" "CONFIG_$ARG=\"${1//\"/\\\\\"}\"" 136 set_var "${CONFIG_}$ARG" "${CONFIG_}$ARG=\"${1//\"/\\\\\"}\""
112 shift 137 shift
113 ;; 138 ;;
114 139
115 --set-val) 140 --set-val)
116 set_var "CONFIG_$ARG" "CONFIG_$ARG=$1" 141 set_var "${CONFIG_}$ARG" "${CONFIG_}$ARG=$1"
117 shift 142 shift
118 ;; 143 ;;
144 --undefine|-u)
145 undef_var "${CONFIG_}$ARG"
146 ;;
119 147
120 --state|-s) 148 --state|-s)
121 if grep -q "# CONFIG_$ARG is not set" $FN ; then 149 if grep -q "# ${CONFIG_}$ARG is not set" $FN ; then
122 echo n 150 echo n
123 else 151 else
124 V="$(grep "^CONFIG_$ARG=" $FN)" 152 V="$(grep "^${CONFIG_}$ARG=" $FN)"
125 if [ $? != 0 ] ; then 153 if [ $? != 0 ] ; then
126 echo undef 154 echo undef
127 else 155 else
128 V="${V/#CONFIG_$ARG=/}" 156 V="${V/#${CONFIG_}$ARG=/}"
129 V="${V/#\"/}" 157 V="${V/#\"/}"
130 V="${V/%\"/}" 158 V="${V/%\"/}"
131 V="${V//\\\"/\"}" 159 V="${V//\\\"/\"}"
@@ -135,15 +163,15 @@ while [ "$1" != "" ] ; do
135 ;; 163 ;;
136 164
137 --enable-after|-E) 165 --enable-after|-E)
138 set_var "CONFIG_$B" "CONFIG_$B=y" "CONFIG_$A" 166 set_var "${CONFIG_}$B" "${CONFIG_}$B=y" "${CONFIG_}$A"
139 ;; 167 ;;
140 168
141 --disable-after|-D) 169 --disable-after|-D)
142 set_var "CONFIG_$B" "# CONFIG_$B is not set" "CONFIG_$A" 170 set_var "${CONFIG_}$B" "# ${CONFIG_}$B is not set" "${CONFIG_}$A"
143 ;; 171 ;;
144 172
145 --module-after|-M) 173 --module-after|-M)
146 set_var "CONFIG_$B" "CONFIG_$B=m" "CONFIG_$A" 174 set_var "${CONFIG_}$B" "${CONFIG_}$B=m" "${CONFIG_}$A"
147 ;; 175 ;;
148 176
149 # undocumented because it ignores --file (fixme) 177 # undocumented because it ignores --file (fixme)
diff --git a/scripts/package/builddeb b/scripts/package/builddeb
index c95fdda58414..acb86507828a 100644
--- a/scripts/package/builddeb
+++ b/scripts/package/builddeb
@@ -92,7 +92,7 @@ rm -rf "$tmpdir" "$fwdir" "$kernel_headers_dir" "$libc_headers_dir"
92mkdir -m 755 -p "$tmpdir/DEBIAN" 92mkdir -m 755 -p "$tmpdir/DEBIAN"
93mkdir -p "$tmpdir/lib" "$tmpdir/boot" "$tmpdir/usr/share/doc/$packagename" 93mkdir -p "$tmpdir/lib" "$tmpdir/boot" "$tmpdir/usr/share/doc/$packagename"
94mkdir -m 755 -p "$fwdir/DEBIAN" 94mkdir -m 755 -p "$fwdir/DEBIAN"
95mkdir -p "$fwdir/lib" "$fwdir/usr/share/doc/$fwpackagename" 95mkdir -p "$fwdir/lib/firmware/$version/" "$fwdir/usr/share/doc/$fwpackagename"
96mkdir -m 755 -p "$libc_headers_dir/DEBIAN" 96mkdir -m 755 -p "$libc_headers_dir/DEBIAN"
97mkdir -p "$libc_headers_dir/usr/share/doc/$libc_headers_packagename" 97mkdir -p "$libc_headers_dir/usr/share/doc/$libc_headers_packagename"
98mkdir -m 755 -p "$kernel_headers_dir/DEBIAN" 98mkdir -m 755 -p "$kernel_headers_dir/DEBIAN"
@@ -243,7 +243,7 @@ EOF
243fi 243fi
244 244
245# Build header package 245# Build header package
246(cd $srctree; find . -name Makefile -o -name Kconfig\* -o -name \*.pl > "$objtree/debian/hdrsrcfiles") 246(cd $srctree; find . -name Makefile\* -o -name Kconfig\* -o -name \*.pl > "$objtree/debian/hdrsrcfiles")
247(cd $srctree; find arch/$SRCARCH/include include scripts -type f >> "$objtree/debian/hdrsrcfiles") 247(cd $srctree; find arch/$SRCARCH/include include scripts -type f >> "$objtree/debian/hdrsrcfiles")
248(cd $objtree; find arch/$SRCARCH/include .config Module.symvers include scripts -type f >> "$objtree/debian/hdrobjfiles") 248(cd $objtree; find arch/$SRCARCH/include .config Module.symvers include scripts -type f >> "$objtree/debian/hdrobjfiles")
249destdir=$kernel_headers_dir/usr/src/linux-headers-$version 249destdir=$kernel_headers_dir/usr/src/linux-headers-$version
@@ -267,7 +267,8 @@ EOF
267 267
268# 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.
269if [ -e "$tmpdir/lib/firmware" ]; then 269if [ -e "$tmpdir/lib/firmware" ]; then
270 mv "$tmpdir/lib/firmware" "$fwdir/lib/" 270 mv "$tmpdir/lib/firmware"/* "$fwdir/lib/firmware/$version/"
271 rmdir "$tmpdir/lib/firmware"
271 272
272 cat <<EOF >> debian/control 273 cat <<EOF >> debian/control
273 274
diff --git a/scripts/tags.sh b/scripts/tags.sh
index cf7b12fee573..cff8faad73d1 100755
--- a/scripts/tags.sh
+++ b/scripts/tags.sh
@@ -153,7 +153,8 @@ exuberant()
153 --regex-c++='/CLEARPAGEFLAG_NOOP\(([^,)]*).*/ClearPage\1/' \ 153 --regex-c++='/CLEARPAGEFLAG_NOOP\(([^,)]*).*/ClearPage\1/' \
154 --regex-c++='/__CLEARPAGEFLAG_NOOP\(([^,)]*).*/__ClearPage\1/' \ 154 --regex-c++='/__CLEARPAGEFLAG_NOOP\(([^,)]*).*/__ClearPage\1/' \
155 --regex-c++='/TESTCLEARFLAG_FALSE\(([^,)]*).*/TestClearPage\1/' \ 155 --regex-c++='/TESTCLEARFLAG_FALSE\(([^,)]*).*/TestClearPage\1/' \
156 --regex-c++='/__TESTCLEARFLAG_FALSE\(([^,)]*).*/__TestClearPage\1/' 156 --regex-c++='/__TESTCLEARFLAG_FALSE\(([^,)]*).*/__TestClearPage\1/' \
157 --regex-c++='/_PE\(([^,)]*).*/PEVENT_ERRNO__\1/'
157 158
158 all_kconfigs | xargs $1 -a \ 159 all_kconfigs | xargs $1 -a \
159 --langdef=kconfig --language-force=kconfig \ 160 --langdef=kconfig --language-force=kconfig \
@@ -195,7 +196,8 @@ emacs()
195 --regex='/CLEARPAGEFLAG_NOOP\(([^,)]*).*/ClearPage\1/' \ 196 --regex='/CLEARPAGEFLAG_NOOP\(([^,)]*).*/ClearPage\1/' \
196 --regex='/__CLEARPAGEFLAG_NOOP\(([^,)]*).*/__ClearPage\1/' \ 197 --regex='/__CLEARPAGEFLAG_NOOP\(([^,)]*).*/__ClearPage\1/' \
197 --regex='/TESTCLEARFLAG_FALSE\(([^,)]*).*/TestClearPage\1/' \ 198 --regex='/TESTCLEARFLAG_FALSE\(([^,)]*).*/TestClearPage\1/' \
198 --regex='/__TESTCLEARFLAG_FALSE\(([^,)]*).*/__TestClearPage\1/' 199 --regex='/__TESTCLEARFLAG_FALSE\(([^,)]*).*/__TestClearPage\1/' \
200 --regex='/_PE\(([^,)]*).*/PEVENT_ERRNO__\1/'
199 201
200 all_kconfigs | xargs $1 -a \ 202 all_kconfigs | xargs $1 -a \
201 --regex='/^[ \t]*\(\(menu\)*config\)[ \t]+\([a-zA-Z0-9_]+\)/\3/' 203 --regex='/^[ \t]*\(\(menu\)*config\)[ \t]+\([a-zA-Z0-9_]+\)/\3/'