diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-02-01 11:43:45 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-02-01 11:43:45 -0800 |
commit | a659f1598585071eed5c39485840b0f018c9f457 (patch) | |
tree | 9d785768a926c3dc2b42944b5851620684e00dba /scripts/coccinelle/api/alloc/kzalloc-simple.cocci | |
parent | 06c8f7a7501ab3ae338a98ff8515b9f03160bea6 (diff) | |
parent | 1640eea35e8dcf0cb437f03c56868a97d0666df3 (diff) | |
download | linux-stable-a659f1598585071eed5c39485840b0f018c9f457.tar.gz linux-stable-a659f1598585071eed5c39485840b0f018c9f457.tar.bz2 linux-stable-a659f1598585071eed5c39485840b0f018c9f457.zip |
Merge tag 'kbuild-misc-v4.16' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild
Pull Kbuild misc updates from Masahiro Yamada:
- add snap-pkg target to create Linux kernel snap package
- make out-of-tree creation of source packages fail correctly
- improve and fix several semantic patches
* tag 'kbuild-misc-v4.16' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
Coccinelle: coccicheck: fix typo
Coccinelle: memdup: drop spurious line
Coccinelle: kzalloc-simple: Rename kzalloc-simple to zalloc-simple
Coccinelle: ifnullfree: Trim the warning reported in report mode
Coccinelle: alloc_cast: Add more memory allocating functions to the list
Coccinelle: array_size: report even if include is missing
Coccinelle: kzalloc-simple: Add all zero allocating functions
kbuild: pkg: make out-of-tree rpm/deb-pkg build immediately fail
scripts/package: snap-pkg target
Diffstat (limited to 'scripts/coccinelle/api/alloc/kzalloc-simple.cocci')
-rw-r--r-- | scripts/coccinelle/api/alloc/kzalloc-simple.cocci | 86 |
1 files changed, 0 insertions, 86 deletions
diff --git a/scripts/coccinelle/api/alloc/kzalloc-simple.cocci b/scripts/coccinelle/api/alloc/kzalloc-simple.cocci deleted file mode 100644 index 52c55e4fa67d..000000000000 --- a/scripts/coccinelle/api/alloc/kzalloc-simple.cocci +++ /dev/null @@ -1,86 +0,0 @@ -/// -/// Use kzalloc rather than kmalloc followed by memset with 0 -/// -/// This considers some simple cases that are common and easy to validate -/// Note in particular that there are no ...s in the rule, so all of the -/// matched code has to be contiguous -/// -// Confidence: High -// Copyright: (C) 2009-2010 Julia Lawall, Nicolas Palix, DIKU. GPLv2. -// Copyright: (C) 2009-2010 Gilles Muller, INRIA/LiP6. GPLv2. -// URL: http://coccinelle.lip6.fr/rules/kzalloc.html -// Options: --no-includes --include-headers -// -// Keywords: kmalloc, kzalloc -// Version min: < 2.6.12 kmalloc -// Version min: 2.6.14 kzalloc -// - -virtual context -virtual patch -virtual org -virtual report - -//---------------------------------------------------------- -// For context mode -//---------------------------------------------------------- - -@depends on context@ -type T, T2; -expression x; -expression E1,E2; -statement S; -@@ - -* x = (T)kmalloc(E1,E2); - if ((x==NULL) || ...) S -* memset((T2)x,0,E1); - -//---------------------------------------------------------- -// For patch mode -//---------------------------------------------------------- - -@depends on patch@ -type T, T2; -expression x; -expression E1,E2; -statement S; -@@ - -- x = (T)kmalloc(E1,E2); -+ x = kzalloc(E1,E2); - if ((x==NULL) || ...) S -- memset((T2)x,0,E1); - -//---------------------------------------------------------- -// For org mode -//---------------------------------------------------------- - -@r depends on org || report@ -type T, T2; -expression x; -expression E1,E2; -statement S; -position p; -@@ - - x = (T)kmalloc@p(E1,E2); - if ((x==NULL) || ...) S - memset((T2)x,0,E1); - -@script:python depends on org@ -p << r.p; -x << r.x; -@@ - -msg="%s" % (x) -msg_safe=msg.replace("[","@(").replace("]",")") -coccilib.org.print_todo(p[0], msg_safe) - -@script:python depends on report@ -p << r.p; -x << r.x; -@@ - -msg="WARNING: kzalloc should be used for %s, instead of kmalloc/memset" % (x) -coccilib.report.print_report(p[0], msg) |