aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-03-24 22:42:50 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-03-24 22:42:50 -0400
commit70c5eb84738cba88e08526fa14e06418cb2bd473 (patch)
tree36b586e8dc7e5dff570a18d030d222380edeec44 /scripts
parent3a1ef0e03eee4c5ac30d19bb1b88e57924295810 (diff)
parent6ef41e22a320d95a246d45b673aa7247cc1bbf7b (diff)
Merge branch 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild
Pull kbuild misc updates from Michal Marek: "The non-critical part of kbuild for v4.6-rc1: - coccinelle cleanup and a new patch - make tags rule for kprobe helpers - make rpm fix to avoid spurious grub2 entries - make rpm support for %postun script (Fedora only at the moment)" * 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild: kbuild/mkspec: clean boot loader configuration on rpm removal kbuild/mkspec: fix grub2 installkernel issue Coccinelle: Add api/setup_timer.cocci coccinelle: bugon: reduce rule applicability Coccinelle: pm_runtime: reduce rule applicability Coccinelle: array_size: reduce rule applicability Coccinelle: reduce rule applicability scripts/tags.sh: add regex to map kprobe helpers scripts/coccinelle: modernize &
Diffstat (limited to 'scripts')
-rw-r--r--scripts/coccinelle/api/pm_runtime.cocci2
-rw-r--r--scripts/coccinelle/api/setup_timer.cocci199
-rw-r--r--scripts/coccinelle/iterators/use_after_iter.cocci2
-rw-r--r--scripts/coccinelle/misc/array_size.cocci2
-rw-r--r--scripts/coccinelle/misc/badty.cocci2
-rw-r--r--scripts/coccinelle/misc/bugon.cocci2
-rwxr-xr-xscripts/package/mkspec13
-rwxr-xr-xscripts/tags.sh2
8 files changed, 215 insertions, 9 deletions
diff --git a/scripts/coccinelle/api/pm_runtime.cocci b/scripts/coccinelle/api/pm_runtime.cocci
index b7042d074078..89b98a2f7a6f 100644
--- a/scripts/coccinelle/api/pm_runtime.cocci
+++ b/scripts/coccinelle/api/pm_runtime.cocci
@@ -78,7 +78,7 @@ ret = pm_runtime_api(...);
78// For org and report mode 78// For org and report mode
79//---------------------------------------------------------- 79//----------------------------------------------------------
80 80
81@r depends on runtime_bad_err_handle exists@ 81@r depends on runtime_bad_err_handle && (org || report) exists@
82position p1, p2; 82position p1, p2;
83identifier pm_runtime_api; 83identifier pm_runtime_api;
84expression ret; 84expression ret;
diff --git a/scripts/coccinelle/api/setup_timer.cocci b/scripts/coccinelle/api/setup_timer.cocci
new file mode 100644
index 000000000000..8ee0ac30e547
--- /dev/null
+++ b/scripts/coccinelle/api/setup_timer.cocci
@@ -0,0 +1,199 @@
1/// Use setup_timer function instead of initializing timer with the function
2/// and data fields
3// Confidence: High
4// Copyright: (C) 2016 Vaishali Thakkar, Oracle. GPLv2
5// Options: --no-includes --include-headers
6// Keywords: init_timer, setup_timer
7
8virtual patch
9virtual context
10virtual org
11virtual report
12
13@match_immediate_function_data_after_init_timer
14depends on patch && !context && !org && !report@
15expression e, func, da;
16@@
17
18-init_timer (&e);
19+setup_timer (&e, func, da);
20
21(
22-e.function = func;
23-e.data = da;
24|
25-e.data = da;
26-e.function = func;
27)
28
29@match_function_and_data_after_init_timer
30depends on patch && !context && !org && !report@
31expression e1, e2, e3, e4, e5, a, b;
32@@
33
34-init_timer (&e1);
35+setup_timer (&e1, a, b);
36
37... when != a = e2
38 when != b = e3
39(
40-e1.function = a;
41... when != b = e4
42-e1.data = b;
43|
44-e1.data = b;
45... when != a = e5
46-e1.function = a;
47)
48
49@r1 exists@
50identifier f;
51position p;
52@@
53
54f(...) { ... when any
55 init_timer@p(...)
56 ... when any
57}
58
59@r2 exists@
60identifier g != r1.f;
61struct timer_list t;
62expression e8;
63@@
64
65g(...) { ... when any
66 t.data = e8
67 ... when any
68}
69
70// It is dangerous to use setup_timer if data field is initialized
71// in another function.
72
73@script:python depends on r2@
74p << r1.p;
75@@
76
77cocci.include_match(False)
78
79@r3 depends on patch && !context && !org && !report@
80expression e6, e7, c;
81position r1.p;
82@@
83
84-init_timer@p (&e6);
85+setup_timer (&e6, c, 0UL);
86... when != c = e7
87-e6.function = c;
88
89// ----------------------------------------------------------------------------
90
91@match_immediate_function_data_after_init_timer_context
92depends on !patch && (context || org || report)@
93expression da, e, func;
94position j0, j1, j2;
95@@
96
97* init_timer@j0 (&e);
98(
99* e@j1.function = func;
100* e@j2.data = da;
101|
102* e@j1.data = da;
103* e@j2.function = func;
104)
105
106@match_function_and_data_after_init_timer_context
107depends on !patch &&
108!match_immediate_function_data_after_init_timer_context &&
109(context || org || report)@
110expression a, b, e1, e2, e3, e4, e5;
111position j0, j1, j2;
112@@
113
114* init_timer@j0 (&e1);
115... when != a = e2
116 when != b = e3
117(
118* e1@j1.function = a;
119... when != b = e4
120* e1@j2.data = b;
121|
122* e1@j1.data = b;
123... when != a = e5
124* e1@j2.function = a;
125)
126
127@r3_context depends on !patch &&
128!match_immediate_function_data_after_init_timer_context &&
129!match_function_and_data_after_init_timer_context &&
130(context || org || report)@
131expression c, e6, e7;
132position r1.p;
133position j0, j1;
134@@
135
136* init_timer@j0@p (&e6);
137... when != c = e7
138* e6@j1.function = c;
139
140// ----------------------------------------------------------------------------
141
142@script:python match_immediate_function_data_after_init_timer_org
143depends on org@
144j0 << match_immediate_function_data_after_init_timer_context.j0;
145j1 << match_immediate_function_data_after_init_timer_context.j1;
146j2 << match_immediate_function_data_after_init_timer_context.j2;
147@@
148
149msg = "Use setup_timer function."
150coccilib.org.print_todo(j0[0], msg)
151coccilib.org.print_link(j1[0], "")
152coccilib.org.print_link(j2[0], "")
153
154@script:python match_function_and_data_after_init_timer_org depends on org@
155j0 << match_function_and_data_after_init_timer_context.j0;
156j1 << match_function_and_data_after_init_timer_context.j1;
157j2 << match_function_and_data_after_init_timer_context.j2;
158@@
159
160msg = "Use setup_timer function."
161coccilib.org.print_todo(j0[0], msg)
162coccilib.org.print_link(j1[0], "")
163coccilib.org.print_link(j2[0], "")
164
165@script:python r3_org depends on org@
166j0 << r3_context.j0;
167j1 << r3_context.j1;
168@@
169
170msg = "Use setup_timer function."
171coccilib.org.print_todo(j0[0], msg)
172coccilib.org.print_link(j1[0], "")
173
174// ----------------------------------------------------------------------------
175
176@script:python match_immediate_function_data_after_init_timer_report
177depends on report@
178j0 << match_immediate_function_data_after_init_timer_context.j0;
179j1 << match_immediate_function_data_after_init_timer_context.j1;
180@@
181
182msg = "Use setup_timer function for function on line %s." % (j1[0].line)
183coccilib.report.print_report(j0[0], msg)
184
185@script:python match_function_and_data_after_init_timer_report depends on report@
186j0 << match_function_and_data_after_init_timer_context.j0;
187j1 << match_function_and_data_after_init_timer_context.j1;
188@@
189
190msg = "Use setup_timer function for function on line %s." % (j1[0].line)
191coccilib.report.print_report(j0[0], msg)
192
193@script:python r3_report depends on report@
194j0 << r3_context.j0;
195j1 << r3_context.j1;
196@@
197
198msg = "Use setup_timer function for function on line %s." % (j1[0].line)
199coccilib.report.print_report(j0[0], msg)
diff --git a/scripts/coccinelle/iterators/use_after_iter.cocci b/scripts/coccinelle/iterators/use_after_iter.cocci
index f085f5968c52..ce8cc9c006e5 100644
--- a/scripts/coccinelle/iterators/use_after_iter.cocci
+++ b/scripts/coccinelle/iterators/use_after_iter.cocci
@@ -123,7 +123,7 @@ list_remove_head(x,c,...)
123| 123|
124sizeof(<+...c...+>) 124sizeof(<+...c...+>)
125| 125|
126&c->member 126 &c->member
127| 127|
128c = E 128c = E
129| 129|
diff --git a/scripts/coccinelle/misc/array_size.cocci b/scripts/coccinelle/misc/array_size.cocci
index 81e279cd347b..6ec05710b017 100644
--- a/scripts/coccinelle/misc/array_size.cocci
+++ b/scripts/coccinelle/misc/array_size.cocci
@@ -59,7 +59,7 @@ T[] E;
59// For org and report mode 59// For org and report mode
60//---------------------------------------------------------- 60//----------------------------------------------------------
61 61
62@r@ 62@r depends on (org || report)@
63type T; 63type T;
64T[] E; 64T[] E;
65position p; 65position p;
diff --git a/scripts/coccinelle/misc/badty.cocci b/scripts/coccinelle/misc/badty.cocci
index 2fc06fc71927..481cf301ccfc 100644
--- a/scripts/coccinelle/misc/badty.cocci
+++ b/scripts/coccinelle/misc/badty.cocci
@@ -50,7 +50,7 @@ T **x;
50// For org and report mode 50// For org and report mode
51//---------------------------------------------------------- 51//----------------------------------------------------------
52 52
53@r disable sizeof_type_expr@ 53@r depends on (org || report) disable sizeof_type_expr@
54type T; 54type T;
55T **x; 55T **x;
56position p; 56position p;
diff --git a/scripts/coccinelle/misc/bugon.cocci b/scripts/coccinelle/misc/bugon.cocci
index 27c97f1f2767..741586094abe 100644
--- a/scripts/coccinelle/misc/bugon.cocci
+++ b/scripts/coccinelle/misc/bugon.cocci
@@ -40,7 +40,7 @@ expression e;
40// For org and report mode 40// For org and report mode
41//---------------------------------------------------------- 41//----------------------------------------------------------
42 42
43@r@ 43@r depends on (org || report)@
44expression e; 44expression e;
45position p; 45position p;
46@@ 46@@
diff --git a/scripts/package/mkspec b/scripts/package/mkspec
index 71004daefe31..b6de63cb3f23 100755
--- a/scripts/package/mkspec
+++ b/scripts/package/mkspec
@@ -131,11 +131,16 @@ echo 'rm -rf $RPM_BUILD_ROOT'
131echo "" 131echo ""
132echo "%post" 132echo "%post"
133echo "if [ -x /sbin/installkernel -a -r /boot/vmlinuz-$KERNELRELEASE -a -r /boot/System.map-$KERNELRELEASE ]; then" 133echo "if [ -x /sbin/installkernel -a -r /boot/vmlinuz-$KERNELRELEASE -a -r /boot/System.map-$KERNELRELEASE ]; then"
134echo "cp /boot/vmlinuz-$KERNELRELEASE /boot/vmlinuz-$KERNELRELEASE-rpm" 134echo "cp /boot/vmlinuz-$KERNELRELEASE /boot/.vmlinuz-$KERNELRELEASE-rpm"
135echo "cp /boot/System.map-$KERNELRELEASE /boot/System.map-$KERNELRELEASE-rpm" 135echo "cp /boot/System.map-$KERNELRELEASE /boot/.System.map-$KERNELRELEASE-rpm"
136echo "rm -f /boot/vmlinuz-$KERNELRELEASE /boot/System.map-$KERNELRELEASE" 136echo "rm -f /boot/vmlinuz-$KERNELRELEASE /boot/System.map-$KERNELRELEASE"
137echo "/sbin/installkernel $KERNELRELEASE /boot/vmlinuz-$KERNELRELEASE-rpm /boot/System.map-$KERNELRELEASE-rpm" 137echo "/sbin/installkernel $KERNELRELEASE /boot/.vmlinuz-$KERNELRELEASE-rpm /boot/.System.map-$KERNELRELEASE-rpm"
138echo "rm -f /boot/vmlinuz-$KERNELRELEASE-rpm /boot/System.map-$KERNELRELEASE-rpm" 138echo "rm -f /boot/.vmlinuz-$KERNELRELEASE-rpm /boot/.System.map-$KERNELRELEASE-rpm"
139echo "fi"
140echo ""
141echo "%preun"
142echo "if [ -x /sbin/new-kernel-pkg ]; then"
143echo "new-kernel-pkg --remove $KERNELRELEASE --rminitrd --initrdfile=/boot/initramfs-$KERNELRELEASE.img"
139echo "fi" 144echo "fi"
140echo "" 145echo ""
141echo "%files" 146echo "%files"
diff --git a/scripts/tags.sh b/scripts/tags.sh
index 23ba1c6a0a59..f72f48f638ae 100755
--- a/scripts/tags.sh
+++ b/scripts/tags.sh
@@ -163,6 +163,8 @@ regex_c=(
163 '/^TRACE_EVENT(\([[:alnum:]_]*\).*/trace_\1_rcuidle/' 163 '/^TRACE_EVENT(\([[:alnum:]_]*\).*/trace_\1_rcuidle/'
164 '/^DEFINE_EVENT([^,)]*, *\([[:alnum:]_]*\).*/trace_\1/' 164 '/^DEFINE_EVENT([^,)]*, *\([[:alnum:]_]*\).*/trace_\1/'
165 '/^DEFINE_EVENT([^,)]*, *\([[:alnum:]_]*\).*/trace_\1_rcuidle/' 165 '/^DEFINE_EVENT([^,)]*, *\([[:alnum:]_]*\).*/trace_\1_rcuidle/'
166 '/^DEFINE_INSN_CACHE_OPS(\([[:alnum:]_]*\).*/get_\1_slot/'
167 '/^DEFINE_INSN_CACHE_OPS(\([[:alnum:]_]*\).*/free_\1_slot/'
166 '/^PAGEFLAG(\([[:alnum:]_]*\).*/Page\1/' 168 '/^PAGEFLAG(\([[:alnum:]_]*\).*/Page\1/'
167 '/^PAGEFLAG(\([[:alnum:]_]*\).*/SetPage\1/' 169 '/^PAGEFLAG(\([[:alnum:]_]*\).*/SetPage\1/'
168 '/^PAGEFLAG(\([[:alnum:]_]*\).*/ClearPage\1/' 170 '/^PAGEFLAG(\([[:alnum:]_]*\).*/ClearPage\1/'