diff options
author | Srikant Patnaik | 2015-01-11 12:28:04 +0530 |
---|---|---|
committer | Srikant Patnaik | 2015-01-11 12:28:04 +0530 |
commit | 871480933a1c28f8a9fed4c4d34d06c439a7a422 (patch) | |
tree | 8718f573808810c2a1e8cb8fb6ac469093ca2784 /ANDROID_3.4.5/scripts/coccinelle/null | |
parent | 9d40ac5867b9aefe0722bc1f110b965ff294d30d (diff) | |
download | FOSSEE-netbook-kernel-source-871480933a1c28f8a9fed4c4d34d06c439a7a422.tar.gz FOSSEE-netbook-kernel-source-871480933a1c28f8a9fed4c4d34d06c439a7a422.tar.bz2 FOSSEE-netbook-kernel-source-871480933a1c28f8a9fed4c4d34d06c439a7a422.zip |
Moved, renamed, and deleted files
The original directory structure was scattered and unorganized.
Changes are basically to make it look like kernel structure.
Diffstat (limited to 'ANDROID_3.4.5/scripts/coccinelle/null')
-rw-r--r-- | ANDROID_3.4.5/scripts/coccinelle/null/badzero.cocci | 237 | ||||
-rw-r--r-- | ANDROID_3.4.5/scripts/coccinelle/null/deref_null.cocci | 282 | ||||
-rw-r--r-- | ANDROID_3.4.5/scripts/coccinelle/null/eno.cocci | 48 | ||||
-rw-r--r-- | ANDROID_3.4.5/scripts/coccinelle/null/kmerr.cocci | 72 |
4 files changed, 0 insertions, 639 deletions
diff --git a/ANDROID_3.4.5/scripts/coccinelle/null/badzero.cocci b/ANDROID_3.4.5/scripts/coccinelle/null/badzero.cocci deleted file mode 100644 index d79baf72..00000000 --- a/ANDROID_3.4.5/scripts/coccinelle/null/badzero.cocci +++ /dev/null @@ -1,237 +0,0 @@ -/// Compare pointer-typed values to NULL rather than 0 -/// -//# This makes an effort to choose between !x and x == NULL. !x is used -//# if it has previously been used with the function used to initialize x. -//# This relies on type information. More type information can be obtained -//# using the option -all_includes and the option -I to specify an -//# include path. -// -// Confidence: High -// Copyright: (C) 2012 Julia Lawall, INRIA/LIP6. GPLv2. -// Copyright: (C) 2012 Gilles Muller, INRIA/LiP6. GPLv2. -// URL: http://coccinelle.lip6.fr/ -// Comments: -// Options: - -virtual patch -virtual context -virtual org -virtual report - -@initialize:ocaml@ -let negtable = Hashtbl.create 101 - -@depends on patch@ -expression *E; -identifier f; -@@ - -( - (E = f(...)) == -- 0 -+ NULL -| - (E = f(...)) != -- 0 -+ NULL -| -- 0 -+ NULL - == (E = f(...)) -| -- 0 -+ NULL - != (E = f(...)) -) - - -@t1 depends on !patch@ -expression *E; -identifier f; -position p; -@@ - -( - (E = f(...)) == -* 0@p -| - (E = f(...)) != -* 0@p -| -* 0@p - == (E = f(...)) -| -* 0@p - != (E = f(...)) -) - -@script:python depends on org@ -p << t1.p; -@@ - -coccilib.org.print_todo(p[0], "WARNING comparing pointer to 0") - -@script:python depends on report@ -p << t1.p; -@@ - -coccilib.report.print_report(p[0], "WARNING comparing pointer to 0") - -// Tests of returned values - -@s@ -identifier f; -expression E,E1; -@@ - - E = f(...) - ... when != E = E1 - !E - -@script:ocaml depends on s@ -f << s.f; -@@ - -try let _ = Hashtbl.find negtable f in () -with Not_found -> Hashtbl.add negtable f () - -@ r disable is_zero,isnt_zero exists @ -expression *E; -identifier f; -@@ - -E = f(...) -... -(E == 0 -|E != 0 -|0 == E -|0 != E -) - -@script:ocaml@ -f << r.f; -@@ - -try let _ = Hashtbl.find negtable f in () -with Not_found -> include_match false - -// This rule may lead to inconsistent path problems, if E is defined in two -// places -@ depends on patch disable is_zero,isnt_zero @ -expression *E; -expression E1; -identifier r.f; -@@ - -E = f(...) -<... -( -- E == 0 -+ !E -| -- E != 0 -+ E -| -- 0 == E -+ !E -| -- 0 != E -+ E -) -...> -?E = E1 - -@t2 depends on !patch disable is_zero,isnt_zero @ -expression *E; -expression E1; -identifier r.f; -position p1; -position p2; -@@ - -E = f(...) -<... -( -* E == 0@p1 -| -* E != 0@p2 -| -* 0@p1 == E -| -* 0@p1 != E -) -...> -?E = E1 - -@script:python depends on org@ -p << t2.p1; -@@ - -coccilib.org.print_todo(p[0], "WARNING comparing pointer to 0, suggest !E") - -@script:python depends on org@ -p << t2.p2; -@@ - -coccilib.org.print_todo(p[0], "WARNING comparing pointer to 0") - -@script:python depends on report@ -p << t2.p1; -@@ - -coccilib.report.print_report(p[0], "WARNING comparing pointer to 0, suggest !E") - -@script:python depends on report@ -p << t2.p2; -@@ - -coccilib.report.print_report(p[0], "WARNING comparing pointer to 0") - -@ depends on patch disable is_zero,isnt_zero @ -expression *E; -@@ - -( - E == -- 0 -+ NULL -| - E != -- 0 -+ NULL -| -- 0 -+ NULL - == E -| -- 0 -+ NULL - != E -) - -@ t3 depends on !patch disable is_zero,isnt_zero @ -expression *E; -position p; -@@ - -( -* E == 0@p -| -* E != 0@p -| -* 0@p == E -| -* 0@p != E -) - -@script:python depends on org@ -p << t3.p; -@@ - -coccilib.org.print_todo(p[0], "WARNING comparing pointer to 0") - -@script:python depends on report@ -p << t3.p; -@@ - -coccilib.report.print_report(p[0], "WARNING comparing pointer to 0") diff --git a/ANDROID_3.4.5/scripts/coccinelle/null/deref_null.cocci b/ANDROID_3.4.5/scripts/coccinelle/null/deref_null.cocci deleted file mode 100644 index cdac6cfc..00000000 --- a/ANDROID_3.4.5/scripts/coccinelle/null/deref_null.cocci +++ /dev/null @@ -1,282 +0,0 @@ -/// -/// A variable is dereference under a NULL test. -/// Even though it is know to be NULL. -/// -// Confidence: Moderate -// Copyright: (C) 2010 Nicolas Palix, DIKU. GPLv2. -// Copyright: (C) 2010 Julia Lawall, DIKU. GPLv2. -// Copyright: (C) 2010 Gilles Muller, INRIA/LiP6. GPLv2. -// URL: http://coccinelle.lip6.fr/ -// Comments: -I ... -all_includes can give more complete results -// Options: - -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; -identifier f; -position p1; -@@ - - (E != NULL && ...) ? <+...E->f@p1...+> : ... - -@pr2 expression@ -expression *ifm.E; -identifier f; -position p2; -@@ - -( - (E != NULL) && ... && <+...E->f@p2...+> -| - (E == NULL) || ... || <+...E->f@p2...+> -| - sizeof(<+...E->f@p2...+>) -) - -// For org and report modes - -@r depends on !context && (org || report) exists@ -expression subE <= ifm.E; -expression *ifm.E; -expression E1,E2; -identifier f; -statement S1,S2,S3,S4; -iterator iter; -position p!={pr1.p1,pr2.p2}; -position ifm.p1; -@@ - -if@p1 ((E == NULL && ...) || ...) -{ - ... when != if (...) S1 else S2 -( - iter(subE,...) S4 // no use -| - list_remove_head(E2,subE,...) -| - subE = E1 -| - for(subE = E1;...;...) S4 -| - subE++ -| - ++subE -| - --subE -| - subE-- -| - &subE -| - E->f@p // bad use -) - ... when any - return ...; -} -else S3 - -@script:python depends on !context && !org && report@ -p << r.p; -p1 << ifm.p1; -x << ifm.E; -@@ - -msg="ERROR: %s is NULL but dereferenced." % (x) -coccilib.report.print_report(p[0], msg) -cocci.include_match(False) - -@script:python depends on !context && org && !report@ -p << r.p; -p1 << ifm.p1; -x << ifm.E; -@@ - -msg="ERROR: %s is NULL but dereferenced." % (x) -msg_safe=msg.replace("[","@(").replace("]",")") -cocci.print_main(msg_safe,p) -cocci.include_match(False) - -@s depends on !context && (org || report) exists@ -expression subE <= ifm.E; -expression *ifm.E; -expression E1,E2; -identifier f; -statement S1,S2,S3,S4; -iterator iter; -position p!={pr1.p1,pr2.p2}; -position ifm.p1; -@@ - -if@p1 ((E == NULL && ...) || ...) -{ - ... when != if (...) S1 else S2 -( - iter(subE,...) S4 // no use -| - list_remove_head(E2,subE,...) -| - subE = E1 -| - for(subE = E1;...;...) S4 -| - subE++ -| - ++subE -| - --subE -| - subE-- -| - &subE -| - E->f@p // bad use -) - ... when any -} -else S3 - -@script:python depends on !context && !org && report@ -p << s.p; -p1 << ifm.p1; -x << ifm.E; -@@ - -msg="ERROR: %s is NULL but dereferenced." % (x) -coccilib.report.print_report(p[0], msg) - -@script:python depends on !context && org && !report@ -p << s.p; -p1 << ifm.p1; -x << ifm.E; -@@ - -msg="ERROR: %s is NULL but dereferenced." % (x) -msg_safe=msg.replace("[","@(").replace("]",")") -cocci.print_main(msg_safe,p) - -// For context mode - -@depends on context && !org && !report exists@ -expression subE <= ifm.E; -expression *ifm.E; -expression E1,E2; -identifier f; -statement S1,S2,S3,S4; -iterator iter; -position p!={pr1.p1,pr2.p2}; -position ifm.p1; -@@ - -if@p1 ((E == NULL && ...) || ...) -{ - ... when != if (...) S1 else S2 -( - iter(subE,...) S4 // no use -| - list_remove_head(E2,subE,...) -| - subE = E1 -| - for(subE = E1;...;...) S4 -| - subE++ -| - ++subE -| - --subE -| - subE-- -| - &subE -| -* E->f@p // bad use -) - ... when any - return ...; -} -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@ -expression *E; -statement S1,S2; -position p1; -@@ - -if@p1 ((E == NULL && ...) || ...) S1 else S2 - -@pr11 expression@ -expression *ifm1.E; -identifier f; -position p1; -@@ - - (E != NULL && ...) ? <+...E->f@p1...+> : ... - -@pr12 expression@ -expression *ifm1.E; -identifier f; -position p2; -@@ - -( - (E != NULL) && ... && <+...E->f@p2...+> -| - (E == NULL) || ... || <+...E->f@p2...+> -| - sizeof(<+...E->f@p2...+>) -) - -@depends on context && !org && !report exists@ -expression subE <= ifm1.E; -expression *ifm1.E; -expression E1,E2; -identifier f; -statement S1,S2,S3,S4; -iterator iter; -position p!={pr11.p1,pr12.p2}; -position ifm1.p1; -@@ - -if@p1 ((E == NULL && ...) || ...) -{ - ... when != if (...) S1 else S2 -( - iter(subE,...) S4 // no use -| - list_remove_head(E2,subE,...) -| - subE = E1 -| - for(subE = E1;...;...) S4 -| - subE++ -| - ++subE -| - --subE -| - subE-- -| - &subE -| -* E->f@p // bad use -) - ... when any -} -else S3 diff --git a/ANDROID_3.4.5/scripts/coccinelle/null/eno.cocci b/ANDROID_3.4.5/scripts/coccinelle/null/eno.cocci deleted file mode 100644 index ed961a1f..00000000 --- a/ANDROID_3.4.5/scripts/coccinelle/null/eno.cocci +++ /dev/null @@ -1,48 +0,0 @@ -/// The various basic memory allocation functions don't return ERR_PTR -/// -// Confidence: High -// Copyright: (C) 2010-2012 Nicolas Palix. GPLv2. -// Copyright: (C) 2010-2012 Julia Lawall, INRIA/LIP6. GPLv2. -// Copyright: (C) 2010-2012 Gilles Muller, INRIA/LiP6. GPLv2. -// URL: http://coccinelle.lip6.fr/ -// Comments: -// Options: -no_includes -include_headers - -virtual patch -virtual context -virtual org -virtual report - -@depends on patch@ -expression x,E; -@@ - -x = \(kmalloc\|kzalloc\|kcalloc\|kmem_cache_alloc\|kmem_cache_zalloc\|kmem_cache_alloc_node\|kmalloc_node\|kzalloc_node\)(...) -... when != x = E -- IS_ERR(x) -+ !x - -@r depends on !patch exists@ -expression x,E; -position p1,p2; -@@ - -*x = \(kmalloc@p1\|kzalloc@p1\|kcalloc@p1\|kmem_cache_alloc@p1\|kmem_cache_zalloc@p1\|kmem_cache_alloc_node@p1\|kmalloc_node@p1\|kzalloc_node@p1\)(...) -... when != x = E -* IS_ERR@p2(x) - -@script:python depends on org@ -p1 << r.p1; -p2 << r.p2; -@@ - -cocci.print_main("alloc call",p1) -cocci.print_secs("IS_ERR that should be NULL tests",p2) - -@script:python depends on report@ -p1 << r.p1; -p2 << r.p2; -@@ - -msg = "ERROR: allocation function on line %s returns NULL not ERR_PTR on failure" % (p1[0].line) -coccilib.report.print_report(p2[0], msg) diff --git a/ANDROID_3.4.5/scripts/coccinelle/null/kmerr.cocci b/ANDROID_3.4.5/scripts/coccinelle/null/kmerr.cocci deleted file mode 100644 index 949bf656..00000000 --- a/ANDROID_3.4.5/scripts/coccinelle/null/kmerr.cocci +++ /dev/null @@ -1,72 +0,0 @@ -/// This semantic patch looks for kmalloc etc that are not followed by a -/// NULL check. It only gives a report in the case where there is some -/// error handling code later in the function, which may be helpful -/// in determining what the error handling code for the call to kmalloc etc -/// should be. -/// -// Confidence: High -// Copyright: (C) 2010 Nicolas Palix, DIKU. GPLv2. -// Copyright: (C) 2010 Julia Lawall, DIKU. GPLv2. -// Copyright: (C) 2010 Gilles Muller, INRIA/LiP6. GPLv2. -// URL: http://coccinelle.lip6.fr/ -// Comments: -// Options: -no_includes -include_headers - -virtual context -virtual org -virtual report - -@withtest@ -expression x; -position p; -identifier f,fld; -@@ - -x@p = f(...); -... when != x->fld -\(x == NULL \| x != NULL\) - -@fixed depends on context && !org && !report@ -expression x,x1; -position p1 != withtest.p; -statement S; -position any withtest.p; -identifier f; -@@ - -*x@p1 = \(kmalloc\|kzalloc\|kcalloc\)(...); -... -*x1@p = f(...); -if (!x1) S - -// ------------------------------------------------------------------------ - -@rfixed depends on (org || report) && !context exists@ -expression x,x1; -position p1 != withtest.p; -position p2; -statement S; -position any withtest.p; -identifier f; -@@ - -x@p1 = \(kmalloc\|kzalloc\|kcalloc\)(...); -... -x1@p = f@p2(...); -if (!x1) S - -@script:python depends on org@ -p1 << rfixed.p1; -p2 << rfixed.p2; -@@ - -cocci.print_main("alloc call",p1) -cocci.print_secs("possible model",p2) - -@script:python depends on report@ -p1 << rfixed.p1; -p2 << rfixed.p2; -@@ - -msg = "alloc with no test, possible model on line %s" % (p2[0].line) -coccilib.report.print_report(p1[0],msg) |