summaryrefslogtreecommitdiffstats
path: root/scripts/coccinelle
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-06-06 20:00:15 +0200
committerLinus Torvalds <torvalds@linux-foundation.org>2018-06-06 20:00:15 +0200
commit8715ee75fe6fa3aed367f28aa7a3655e6a8e4688 (patch)
tree192c25a109a73ca67d4483d89ee576660bb5f29c /scripts/coccinelle
parentMerge tag 'sound-4.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/t... (diff)
parentkbuild: add machine size to CHECKFLAGS (diff)
downloadlinux-8715ee75fe6fa3aed367f28aa7a3655e6a8e4688.tar.xz
linux-8715ee75fe6fa3aed367f28aa7a3655e6a8e4688.zip
Merge tag 'kbuild-v4.18' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild
Pull Kbuild updates from Masahiro Yamada: - improve fixdep to coalesce consecutive slashes in dep-files - fix some issues of the maintainer string generation in deb-pkg script - remove unused CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX and clean-up several tools and linker scripts - clean-up modpost - allow to enable the dead code/data elimination for PowerPC in EXPERT mode - improve two coccinelle scripts for better performance - pass endianness and machine size flags to sparse for all architecture - misc fixes * tag 'kbuild-v4.18' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (25 commits) kbuild: add machine size to CHECKFLAGS kbuild: add endianness flag to CHEKCFLAGS kbuild: $(CHECK) doesnt need NOSTDINC_FLAGS twice scripts: Fixed printf format mismatch scripts/tags.sh: use `find` for $ALLSOURCE_ARCHS generation coccinelle: deref_null: improve performance coccinelle: mini_lock: improve performance powerpc: Allow LD_DEAD_CODE_DATA_ELIMINATION to be selected kbuild: Allow LD_DEAD_CODE_DATA_ELIMINATION to be selectable if enabled kbuild: LD_DEAD_CODE_DATA_ELIMINATION no -ffunction-sections/-fdata-sections for module build kbuild: Fix asm-generic/vmlinux.lds.h for LD_DEAD_CODE_DATA_ELIMINATION modpost: constify *modname function argument where possible modpost: remove redundant is_vmlinux() test modpost: use strstarts() helper more widely modpost: pass struct elf_info pointer to get_modinfo() checkpatch: remove VMLINUX_SYMBOL() check vmlinux.lds.h: remove no-op macro VMLINUX_SYMBOL() kbuild: remove CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX export.h: remove code for prefixing symbols with underscore depmod.sh: remove symbol prefix support ...
Diffstat (limited to 'scripts/coccinelle')
-rw-r--r--scripts/coccinelle/locks/mini_lock.cocci6
-rw-r--r--scripts/coccinelle/null/deref_null.cocci40
2 files changed, 24 insertions, 22 deletions
diff --git a/scripts/coccinelle/locks/mini_lock.cocci b/scripts/coccinelle/locks/mini_lock.cocci
index 47f649b0ea87..19c6ee5b986b 100644
--- a/scripts/coccinelle/locks/mini_lock.cocci
+++ b/scripts/coccinelle/locks/mini_lock.cocci
@@ -67,12 +67,14 @@ identifier lock,unlock;
@@
*lock(E1@p,...);
-<+... when != E1
+... when != E1
+ when any
if (...) {
... when != E1
* return@r ...;
}
-...+>
+... when != E1
+ when any
*unlock@up(E1,...);
@script:python depends on org@
diff --git a/scripts/coccinelle/null/deref_null.cocci b/scripts/coccinelle/null/deref_null.cocci
index b16ccb7663a7..cbc6184e69ef 100644
--- a/scripts/coccinelle/null/deref_null.cocci
+++ b/scripts/coccinelle/null/deref_null.cocci
@@ -14,18 +14,10 @@ virtual context
virtual org
virtual report
-@ifm@
-expression *E;
-statement S1,S2;
-position p1;
-@@
-
-if@p1 ((E == NULL && ...) || ...) S1 else S2
-
// The following two rules are separate, because both can match a single
// expression in different ways
@pr1 expression@
-expression *ifm.E;
+expression E;
identifier f;
position p1;
@@
@@ -33,7 +25,7 @@ position p1;
(E != NULL && ...) ? <+...E->f@p1...+> : ...
@pr2 expression@
-expression *ifm.E;
+expression E;
identifier f;
position p2;
@@
@@ -46,6 +38,14 @@ position p2;
sizeof(<+...E->f@p2...+>)
)
+@ifm@
+expression *E;
+statement S1,S2;
+position p1;
+@@
+
+if@p1 ((E == NULL && ...) || ...) S1 else S2
+
// For org and report modes
@r depends on !context && (org || report) exists@
@@ -212,16 +212,8 @@ else S3
// The following three rules are duplicates of ifm, pr1 and pr2 respectively.
// It is need because the previous rule as already made a "change".
-@ifm1 depends on context && !org && !report@
-expression *E;
-statement S1,S2;
-position p1;
-@@
-
-if@p1 ((E == NULL && ...) || ...) S1 else S2
-
@pr11 depends on context && !org && !report expression@
-expression *ifm1.E;
+expression E;
identifier f;
position p1;
@@
@@ -229,7 +221,7 @@ position p1;
(E != NULL && ...) ? <+...E->f@p1...+> : ...
@pr12 depends on context && !org && !report expression@
-expression *ifm1.E;
+expression E;
identifier f;
position p2;
@@
@@ -242,6 +234,14 @@ position p2;
sizeof(<+...E->f@p2...+>)
)
+@ifm1 depends on context && !org && !report@
+expression *E;
+statement S1,S2;
+position p1;
+@@
+
+if@p1 ((E == NULL && ...) || ...) S1 else S2
+
@depends on context && !org && !report exists@
expression subE <= ifm1.E;
expression *ifm1.E;