From 1b669e713f277a4d4b3cec84e13d16544ac8286d Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Thu, 18 Feb 2016 00:16:14 +0100 Subject: scripts/coccinelle: modernize & & is no longer allowed in column 0, since Coccinelle 1.0.4. Signed-off-by: Julia Lawall Tested-by: Nishanth Menon Cc: stable@vger.kernel.org Signed-off-by: Michal Marek --- scripts/coccinelle/iterators/use_after_iter.cocci | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') 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,...) | sizeof(<+...c...+>) | -&c->member + &c->member | c = E | -- cgit v1.2.3 From 0a9e7da660b09f5304bf2b4d3fa8abc938af439a Mon Sep 17 00:00:00 2001 From: "Naveen N. Rao" Date: Thu, 18 Feb 2016 20:56:31 +0530 Subject: scripts/tags.sh: add regex to map kprobe helpers Add regex for [get|free]_[insn|optinsn|dmainsn]_slot() functions. Signed-off-by: Naveen N. Rao Signed-off-by: Michal Marek --- scripts/tags.sh | 2 ++ 1 file changed, 2 insertions(+) (limited to 'scripts') 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=( '/^TRACE_EVENT(\([[:alnum:]_]*\).*/trace_\1_rcuidle/' '/^DEFINE_EVENT([^,)]*, *\([[:alnum:]_]*\).*/trace_\1/' '/^DEFINE_EVENT([^,)]*, *\([[:alnum:]_]*\).*/trace_\1_rcuidle/' + '/^DEFINE_INSN_CACHE_OPS(\([[:alnum:]_]*\).*/get_\1_slot/' + '/^DEFINE_INSN_CACHE_OPS(\([[:alnum:]_]*\).*/free_\1_slot/' '/^PAGEFLAG(\([[:alnum:]_]*\).*/Page\1/' '/^PAGEFLAG(\([[:alnum:]_]*\).*/SetPage\1/' '/^PAGEFLAG(\([[:alnum:]_]*\).*/ClearPage\1/' -- cgit v1.2.3 From 8f551befa2269dc244bcfbcad795132f833cb71c Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Sat, 30 Jan 2016 16:27:04 +0100 Subject: Coccinelle: reduce rule applicability Rule r is only use in org or report mode, so only execute it in those cases. Signed-off-by: Julia Lawall Signed-off-by: Michal Marek --- scripts/coccinelle/misc/badty.cocci | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') 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; // For org and report mode //---------------------------------------------------------- -@r disable sizeof_type_expr@ +@r depends on (org || report) disable sizeof_type_expr@ type T; T **x; position p; -- cgit v1.2.3 From c7eaa8873b3e50667e0b6529141139147f34748e Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Sat, 30 Jan 2016 17:13:54 +0100 Subject: Coccinelle: array_size: reduce rule applicability Rule r is only use in org or report mode, so only execute it in those cases. Signed-off-by: Julia Lawall Signed-off-by: Michal Marek --- scripts/coccinelle/misc/array_size.cocci | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') 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; // For org and report mode //---------------------------------------------------------- -@r@ +@r depends on (org || report)@ type T; T[] E; position p; -- cgit v1.2.3 From 79ff2b3deae7db21e73f1e0add92c988135defd2 Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Sun, 31 Jan 2016 17:26:57 +0100 Subject: Coccinelle: pm_runtime: reduce rule applicability Rule r is only used in org or report mode, so only execute it in those cases. Signed-off-by: Julia Lawall Signed-off-by: Michal Marek --- scripts/coccinelle/api/pm_runtime.cocci | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') 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(...); // For org and report mode //---------------------------------------------------------- -@r depends on runtime_bad_err_handle exists@ +@r depends on runtime_bad_err_handle && (org || report) exists@ position p1, p2; identifier pm_runtime_api; expression ret; -- cgit v1.2.3 From f75621c6ecadbd1802a7142fd346511cea05250a Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Wed, 3 Feb 2016 19:05:46 +0100 Subject: coccinelle: bugon: reduce rule applicability Rule r is only use in org or report mode, so only execute it in those cases. Signed-off-by: Julia Lawall Signed-off-by: Michal Marek --- scripts/coccinelle/misc/bugon.cocci | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') 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; // For org and report mode //---------------------------------------------------------- -@r@ +@r depends on (org || report)@ expression e; position p; @@ -- cgit v1.2.3 From c5eda8fd10c64720d5232189f812a3b1cc983b8b Mon Sep 17 00:00:00 2001 From: Vaishali Thakkar Date: Wed, 10 Feb 2016 15:31:33 +0530 Subject: Coccinelle: Add api/setup_timer.cocci Use the timer API function setup_timer instead of structure field assignments to initialize a timer. Signed-off-by: Vaishali Thakkar Acked-by: Julia Lawall Signed-off-by: Michal Marek --- scripts/coccinelle/api/setup_timer.cocci | 199 +++++++++++++++++++++++++++++++ 1 file changed, 199 insertions(+) create mode 100644 scripts/coccinelle/api/setup_timer.cocci (limited to 'scripts') 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 @@ +/// Use setup_timer function instead of initializing timer with the function +/// and data fields +// Confidence: High +// Copyright: (C) 2016 Vaishali Thakkar, Oracle. GPLv2 +// Options: --no-includes --include-headers +// Keywords: init_timer, setup_timer + +virtual patch +virtual context +virtual org +virtual report + +@match_immediate_function_data_after_init_timer +depends on patch && !context && !org && !report@ +expression e, func, da; +@@ + +-init_timer (&e); ++setup_timer (&e, func, da); + +( +-e.function = func; +-e.data = da; +| +-e.data = da; +-e.function = func; +) + +@match_function_and_data_after_init_timer +depends on patch && !context && !org && !report@ +expression e1, e2, e3, e4, e5, a, b; +@@ + +-init_timer (&e1); ++setup_timer (&e1, a, b); + +... when != a = e2 + when != b = e3 +( +-e1.function = a; +... when != b = e4 +-e1.data = b; +| +-e1.data = b; +... when != a = e5 +-e1.function = a; +) + +@r1 exists@ +identifier f; +position p; +@@ + +f(...) { ... when any + init_timer@p(...) + ... when any +} + +@r2 exists@ +identifier g != r1.f; +struct timer_list t; +expression e8; +@@ + +g(...) { ... when any + t.data = e8 + ... when any +} + +// It is dangerous to use setup_timer if data field is initialized +// in another function. + +@script:python depends on r2@ +p << r1.p; +@@ + +cocci.include_match(False) + +@r3 depends on patch && !context && !org && !report@ +expression e6, e7, c; +position r1.p; +@@ + +-init_timer@p (&e6); ++setup_timer (&e6, c, 0UL); +... when != c = e7 +-e6.function = c; + +// ---------------------------------------------------------------------------- + +@match_immediate_function_data_after_init_timer_context +depends on !patch && (context || org || report)@ +expression da, e, func; +position j0, j1, j2; +@@ + +* init_timer@j0 (&e); +( +* e@j1.function = func; +* e@j2.data = da; +| +* e@j1.data = da; +* e@j2.function = func; +) + +@match_function_and_data_after_init_timer_context +depends on !patch && +!match_immediate_function_data_after_init_timer_context && +(context || org || report)@ +expression a, b, e1, e2, e3, e4, e5; +position j0, j1, j2; +@@ + +* init_timer@j0 (&e1); +... when != a = e2 + when != b = e3 +( +* e1@j1.function = a; +... when != b = e4 +* e1@j2.data = b; +| +* e1@j1.data = b; +... when != a = e5 +* e1@j2.function = a; +) + +@r3_context depends on !patch && +!match_immediate_function_data_after_init_timer_context && +!match_function_and_data_after_init_timer_context && +(context || org || report)@ +expression c, e6, e7; +position r1.p; +position j0, j1; +@@ + +* init_timer@j0@p (&e6); +... when != c = e7 +* e6@j1.function = c; + +// ---------------------------------------------------------------------------- + +@script:python match_immediate_function_data_after_init_timer_org +depends on org@ +j0 << match_immediate_function_data_after_init_timer_context.j0; +j1 << match_immediate_function_data_after_init_timer_context.j1; +j2 << match_immediate_function_data_after_init_timer_context.j2; +@@ + +msg = "Use setup_timer function." +coccilib.org.print_todo(j0[0], msg) +coccilib.org.print_link(j1[0], "") +coccilib.org.print_link(j2[0], "") + +@script:python match_function_and_data_after_init_timer_org depends on org@ +j0 << match_function_and_data_after_init_timer_context.j0; +j1 << match_function_and_data_after_init_timer_context.j1; +j2 << match_function_and_data_after_init_timer_context.j2; +@@ + +msg = "Use setup_timer function." +coccilib.org.print_todo(j0[0], msg) +coccilib.org.print_link(j1[0], "") +coccilib.org.print_link(j2[0], "") + +@script:python r3_org depends on org@ +j0 << r3_context.j0; +j1 << r3_context.j1; +@@ + +msg = "Use setup_timer function." +coccilib.org.print_todo(j0[0], msg) +coccilib.org.print_link(j1[0], "") + +// ---------------------------------------------------------------------------- + +@script:python match_immediate_function_data_after_init_timer_report +depends on report@ +j0 << match_immediate_function_data_after_init_timer_context.j0; +j1 << match_immediate_function_data_after_init_timer_context.j1; +@@ + +msg = "Use setup_timer function for function on line %s." % (j1[0].line) +coccilib.report.print_report(j0[0], msg) + +@script:python match_function_and_data_after_init_timer_report depends on report@ +j0 << match_function_and_data_after_init_timer_context.j0; +j1 << match_function_and_data_after_init_timer_context.j1; +@@ + +msg = "Use setup_timer function for function on line %s." % (j1[0].line) +coccilib.report.print_report(j0[0], msg) + +@script:python r3_report depends on report@ +j0 << r3_context.j0; +j1 << r3_context.j1; +@@ + +msg = "Use setup_timer function for function on line %s." % (j1[0].line) +coccilib.report.print_report(j0[0], msg) -- cgit v1.2.3 From c8b08ca558c0067bc9e15ce3f1e70af260410bb2 Mon Sep 17 00:00:00 2001 From: Jiri Kosina Date: Fri, 26 Feb 2016 16:15:17 +0100 Subject: kbuild/mkspec: fix grub2 installkernel issue mkspec is copying built kernel to temporrary location /boot/vmlinuz-$KERNELRELEASE-rpm and runs installkernel on it. This however directly leads to grub2 menuentry for this suffixed binary being generated as well during the run of installkernel script. Later in the process the temporary -rpm suffixed files are removed, and therefore we end up with spurious (and non-functional) grub2 menu entries for each installed kernel RPM. Fix that by using a different temporary name (prefixed by '.'), so that the binary is not recognized as an actual kernel binary and no menuentry is created for it. Signed-off-by: Jiri Kosina Fixes: 3c9c7a14b627 ("rpm-pkg: add %post section to create initramfs and grub hooks") Signed-off-by: Michal Marek --- scripts/package/mkspec | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'scripts') diff --git a/scripts/package/mkspec b/scripts/package/mkspec index 71004daefe31..fe44d68e9344 100755 --- a/scripts/package/mkspec +++ b/scripts/package/mkspec @@ -131,11 +131,11 @@ echo 'rm -rf $RPM_BUILD_ROOT' echo "" echo "%post" echo "if [ -x /sbin/installkernel -a -r /boot/vmlinuz-$KERNELRELEASE -a -r /boot/System.map-$KERNELRELEASE ]; then" -echo "cp /boot/vmlinuz-$KERNELRELEASE /boot/vmlinuz-$KERNELRELEASE-rpm" -echo "cp /boot/System.map-$KERNELRELEASE /boot/System.map-$KERNELRELEASE-rpm" +echo "cp /boot/vmlinuz-$KERNELRELEASE /boot/.vmlinuz-$KERNELRELEASE-rpm" +echo "cp /boot/System.map-$KERNELRELEASE /boot/.System.map-$KERNELRELEASE-rpm" echo "rm -f /boot/vmlinuz-$KERNELRELEASE /boot/System.map-$KERNELRELEASE" -echo "/sbin/installkernel $KERNELRELEASE /boot/vmlinuz-$KERNELRELEASE-rpm /boot/System.map-$KERNELRELEASE-rpm" -echo "rm -f /boot/vmlinuz-$KERNELRELEASE-rpm /boot/System.map-$KERNELRELEASE-rpm" +echo "/sbin/installkernel $KERNELRELEASE /boot/.vmlinuz-$KERNELRELEASE-rpm /boot/.System.map-$KERNELRELEASE-rpm" +echo "rm -f /boot/.vmlinuz-$KERNELRELEASE-rpm /boot/.System.map-$KERNELRELEASE-rpm" echo "fi" echo "" echo "%files" -- cgit v1.2.3 From 6ef41e22a320d95a246d45b673aa7247cc1bbf7b Mon Sep 17 00:00:00 2001 From: Paolo Abeni Date: Wed, 2 Mar 2016 15:28:00 +0100 Subject: kbuild/mkspec: clean boot loader configuration on rpm removal This patch add a rpm preuninstall scriptlet to cleanup the boot loader configuration on kernel package uninstall. The initrd for the to-be-removed kernel is deleted, too. Signed-off-by: Paolo Abeni Signed-off-by: Michal Marek --- scripts/package/mkspec | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'scripts') diff --git a/scripts/package/mkspec b/scripts/package/mkspec index fe44d68e9344..b6de63cb3f23 100755 --- a/scripts/package/mkspec +++ b/scripts/package/mkspec @@ -138,6 +138,11 @@ echo "/sbin/installkernel $KERNELRELEASE /boot/.vmlinuz-$KERNELRELEASE-rpm /boot echo "rm -f /boot/.vmlinuz-$KERNELRELEASE-rpm /boot/.System.map-$KERNELRELEASE-rpm" echo "fi" echo "" +echo "%preun" +echo "if [ -x /sbin/new-kernel-pkg ]; then" +echo "new-kernel-pkg --remove $KERNELRELEASE --rminitrd --initrdfile=/boot/initramfs-$KERNELRELEASE.img" +echo "fi" +echo "" echo "%files" echo '%defattr (-, root, root)' echo "/lib/modules/$KERNELRELEASE" -- cgit v1.2.3