Skip to content

Commit f6774cb

Browse files
committed
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
2 parents b4e2ed3 + 1fa8505 commit f6774cb

5 files changed

Lines changed: 264 additions & 21 deletions

File tree

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
16+
virtual context
17+
virtual org
18+
virtual report
19+
20+
@r exists@
21+
identifier c,member;
22+
expression E,x;
23+
iterator name list_for_each_entry;
24+
iterator name list_for_each_entry_reverse;
25+
iterator name list_for_each_entry_continue;
26+
iterator name list_for_each_entry_continue_reverse;
27+
iterator name list_for_each_entry_from;
28+
iterator name list_for_each_entry_safe;
29+
iterator name list_for_each_entry_safe_continue;
30+
iterator name list_for_each_entry_safe_from;
31+
iterator name list_for_each_entry_safe_reverse;
32+
iterator name hlist_for_each_entry;
33+
iterator name hlist_for_each_entry_continue;
34+
iterator name hlist_for_each_entry_from;
35+
iterator name hlist_for_each_entry_safe;
36+
statement S;
37+
position p1,p2;
38+
@@
39+
40+
(
41+
list_for_each_entry@p1(c,...,member) { ... when != break;
42+
when forall
43+
when strict
44+
}
45+
|
46+
list_for_each_entry_reverse@p1(c,...,member) { ... when != break;
47+
when forall
48+
when strict
49+
}
50+
|
51+
list_for_each_entry_continue@p1(c,...,member) { ... when != break;
52+
when forall
53+
when strict
54+
}
55+
|
56+
list_for_each_entry_continue_reverse@p1(c,...,member) { ... when != break;
57+
when forall
58+
when strict
59+
}
60+
|
61+
list_for_each_entry_from@p1(c,...,member) { ... when != break;
62+
when forall
63+
when strict
64+
}
65+
|
66+
list_for_each_entry_safe@p1(c,...,member) { ... when != break;
67+
when forall
68+
when strict
69+
}
70+
|
71+
list_for_each_entry_safe_continue@p1(c,...,member) { ... when != break;
72+
when forall
73+
when strict
74+
}
75+
|
76+
list_for_each_entry_safe_from@p1(c,...,member) { ... when != break;
77+
when forall
78+
when strict
79+
}
80+
|
81+
list_for_each_entry_safe_reverse@p1(c,...,member) { ... when != break;
82+
when forall
83+
when strict
84+
}
85+
)
86+
...
87+
(
88+
list_for_each_entry(c,...) S
89+
|
90+
list_for_each_entry_reverse(c,...) S
91+
|
92+
list_for_each_entry_continue(c,...) S
93+
|
94+
list_for_each_entry_continue_reverse(c,...) S
95+
|
96+
list_for_each_entry_from(c,...) S
97+
|
98+
list_for_each_entry_safe(c,...) S
99+
|
100+
list_for_each_entry_safe(x,c,...) S
101+
|
102+
list_for_each_entry_safe_continue(c,...) S
103+
|
104+
list_for_each_entry_safe_continue(x,c,...) S
105+
|
106+
list_for_each_entry_safe_from(c,...) S
107+
|
108+
list_for_each_entry_safe_from(x,c,...) S
109+
|
110+
list_for_each_entry_safe_reverse(c,...) S
111+
|
112+
list_for_each_entry_safe_reverse(x,c,...) S
113+
|
114+
hlist_for_each_entry(c,...) S
115+
|
116+
hlist_for_each_entry_continue(c,...) S
117+
|
118+
hlist_for_each_entry_from(c,...) S
119+
|
120+
hlist_for_each_entry_safe(c,...) S
121+
|
122+
list_remove_head(x,c,...)
123+
|
124+
sizeof(<+...c...+>)
125+
|
126+
&c->member
127+
|
128+
c = E
129+
|
130+
*c@p2
131+
)
132+
133+
@script:python depends on org@
134+
p1 << r.p1;
135+
p2 << r.p2;
136+
@@
137+
138+
cocci.print_main("invalid iterator index reference",p2)
139+
cocci.print_secs("iterator",p1)
140+
141+
@script:python depends on report@
142+
p1 << r.p1;
143+
p2 << r.p2;
144+
@@
145+
146+
msg = "ERROR: invalid reference to the index variable of the iterator on line %s" % (p1[0].line)
147+
coccilib.report.print_report(p2[0], msg)
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
9+
virtual patch
10+
virtual context
11+
virtual org
12+
virtual report
13+
14+
@r1@
15+
expression irq;
16+
expression thread_fn;
17+
expression flags;
18+
position p;
19+
@@
20+
request_threaded_irq@p(irq, NULL, thread_fn,
21+
(
22+
flags | IRQF_ONESHOT
23+
|
24+
IRQF_ONESHOT
25+
)
26+
, ...)
27+
28+
@depends on patch@
29+
expression irq;
30+
expression thread_fn;
31+
expression flags;
32+
position p != r1.p;
33+
@@
34+
request_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@
45+
position p != r1.p;
46+
@@
47+
*request_threaded_irq@p(...)
48+
49+
@match depends on report || org@
50+
expression irq;
51+
position p != r1.p;
52+
@@
53+
request_threaded_irq@p(irq, NULL, ...)
54+
55+
@script:python depends on org@
56+
p << match.p;
57+
@@
58+
msg = "ERROR: Threaded IRQ with no primary handler requested without IRQF_ONESHOT"
59+
coccilib.org.print_todo(p[0],msg)
60+
61+
@script:python depends on report@
62+
p << match.p;
63+
@@
64+
msg = "ERROR: Threaded IRQ with no primary handler requested without IRQF_ONESHOT"
65+
coccilib.report.print_report(p[0],msg)

‎scripts/config‎

Lines changed: 44 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
#!/bin/bash
22
# Manipulate options in a .config file from the command line
33

4+
# If no prefix forced, use the default CONFIG_
5+
CONFIG_="${CONFIG_-CONFIG_}"
6+
47
usage() {
58
cat >&2 <<EOL
69
Manipulate options in a .config file from the command line.
@@ -14,6 +17,7 @@ commands:
1417
Set option to "string"
1518
--set-val option value
1619
Set option to value
20+
--undefine|-u option Undefine option
1721
--state|-s option Print state of option (n,y,m,undef)
1822
1923
--enable-after|-E beforeopt option
@@ -26,10 +30,17 @@ commands:
2630
commands can be repeated multiple times
2731
2832
options:
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)
3035
3136
config doesn't check the validity of the .config file. This is done at next
32-
make time.
37+
make time.
38+
39+
By default, config will upper-case the given symbol. Use --keep-case to keep
40+
the case of all following symbols unchanged.
41+
42+
config uses 'CONFIG_' as the default symbol prefix. Set the environment
43+
variable CONFIG_ to the prefix to use. Eg.: CONFIG_="FOO_" config ...
3344
EOL
3445
exit 1
3546
}
@@ -40,11 +51,13 @@ checkarg() {
4051
usage
4152
fi
4253
case "$ARG" in
43-
CONFIG_*)
44-
ARG="${ARG/CONFIG_/}"
54+
${CONFIG_}*)
55+
ARG="${ARG/${CONFIG_}/}"
4556
;;
4657
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
4861
}
4962

5063
set_var() {
@@ -61,6 +74,12 @@ set_var() {
6174
fi
6275
}
6376

77+
undef_var() {
78+
local name=$1
79+
80+
sed -ri "/^($name=|# $name is not set)/d" "$FN"
81+
}
82+
6483
if [ "$1" = "--file" ]; then
6584
FN="$2"
6685
if [ "$FN" = "" ] ; then
@@ -75,10 +94,16 @@ if [ "$1" = "" ] ; then
7594
usage
7695
fi
7796

97+
MUNGE_CASE=yes
7898
while [ "$1" != "" ] ; do
7999
CMD="$1"
80100
shift
81101
case "$CMD" in
102+
--keep-case|-k)
103+
MUNGE_CASE=no
104+
shift
105+
continue
106+
;;
82107
--refresh)
83108
;;
84109
--*-after)
@@ -95,37 +120,40 @@ while [ "$1" != "" ] ; do
95120
esac
96121
case "$CMD" in
97122
--enable|-e)
98-
set_var "CONFIG_$ARG" "CONFIG_$ARG=y"
123+
set_var "${CONFIG_}$ARG" "${CONFIG_}$ARG=y"
99124
;;
100125

101126
--disable|-d)
102-
set_var "CONFIG_$ARG" "# CONFIG_$ARG is not set"
127+
set_var "${CONFIG_}$ARG" "# ${CONFIG_}$ARG is not set"
103128
;;
104129

105130
--module|-m)
106-
set_var "CONFIG_$ARG" "CONFIG_$ARG=m"
131+
set_var "${CONFIG_}$ARG" "${CONFIG_}$ARG=m"
107132
;;
108133

109134
--set-str)
110135
# 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//\"/\\\\\"}\""
112137
shift
113138
;;
114139

115140
--set-val)
116-
set_var "CONFIG_$ARG" "CONFIG_$ARG=$1"
141+
set_var "${CONFIG_}$ARG" "${CONFIG_}$ARG=$1"
117142
shift
118143
;;
144+
--undefine|-u)
145+
undef_var "${CONFIG_}$ARG"
146+
;;
119147

120148
--state|-s)
121-
if grep -q "# CONFIG_$ARG is not set" $FN ; then
149+
if grep -q "# ${CONFIG_}$ARG is not set" $FN ; then
122150
echo n
123151
else
124-
V="$(grep "^CONFIG_$ARG=" $FN)"
152+
V="$(grep "^${CONFIG_}$ARG=" $FN)"
125153
if [ $? != 0 ] ; then
126154
echo undef
127155
else
128-
V="${V/#CONFIG_$ARG=/}"
156+
V="${V/#${CONFIG_}$ARG=/}"
129157
V="${V/#\"/}"
130158
V="${V/%\"/}"
131159
V="${V//\\\"/\"}"
@@ -135,15 +163,15 @@ while [ "$1" != "" ] ; do
135163
;;
136164

137165
--enable-after|-E)
138-
set_var "CONFIG_$B" "CONFIG_$B=y" "CONFIG_$A"
166+
set_var "${CONFIG_}$B" "${CONFIG_}$B=y" "${CONFIG_}$A"
139167
;;
140168

141169
--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"
143171
;;
144172

145173
--module-after|-M)
146-
set_var "CONFIG_$B" "CONFIG_$B=m" "CONFIG_$A"
174+
set_var "${CONFIG_}$B" "${CONFIG_}$B=m" "${CONFIG_}$A"
147175
;;
148176

149177
# undocumented because it ignores --file (fixme)

‎scripts/package/builddeb‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ rm -rf "$tmpdir" "$fwdir" "$kernel_headers_dir" "$libc_headers_dir"
9292
mkdir -m 755 -p "$tmpdir/DEBIAN"
9393
mkdir -p "$tmpdir/lib" "$tmpdir/boot" "$tmpdir/usr/share/doc/$packagename"
9494
mkdir -m 755 -p "$fwdir/DEBIAN"
95-
mkdir -p "$fwdir/lib" "$fwdir/usr/share/doc/$fwpackagename"
95+
mkdir -p "$fwdir/lib/firmware/$version/" "$fwdir/usr/share/doc/$fwpackagename"
9696
mkdir -m 755 -p "$libc_headers_dir/DEBIAN"
9797
mkdir -p "$libc_headers_dir/usr/share/doc/$libc_headers_packagename"
9898
mkdir -m 755 -p "$kernel_headers_dir/DEBIAN"
@@ -243,7 +243,7 @@ EOF
243243
fi
244244

245245
# 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")
247247
(cd $srctree; find arch/$SRCARCH/include include scripts -type f >> "$objtree/debian/hdrsrcfiles")
248248
(cd $objtree; find arch/$SRCARCH/include .config Module.symvers include scripts -type f >> "$objtree/debian/hdrobjfiles")
249249
destdir=$kernel_headers_dir/usr/src/linux-headers-$version
@@ -267,7 +267,8 @@ EOF
267267

268268
# Do we have firmware? Move it out of the way and build it into a package.
269269
if [ -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"
271272

272273
cat <<EOF >> debian/control
273274

0 commit comments

Comments
 (0)