lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 24 Aug 2010 17:38:57 +0200
From:	Nicolas Palix <npalix@...u.dk>
To:	Julia Lawall <julia@...u.dk>,
	Gilles Muller <Gilles.Muller@...6.fr>,
	Nicolas Palix <npalix@...u.dk>, Michal Marek <mmarek@...e.cz>
Cc:	cocci@...u.dk, linux-kernel@...r.kernel.org,
	kernel-janitors@...r.kernel.org, Nicolas Palix <npalix@...u.dk>
Subject: [PATCH 03/18] Coccinelle: Move deref_null.cocci to a more appropriate directory

deref_null.cocci is moved to the 'null' directory
which contains other null related rules.

Signed-off-by: Nicolas Palix <npalix@...u.dk>
Signed-off-by: Julia Lawall <julia@...u.dk>
---
 scripts/coccinelle/deref_null.cocci      |  293 ------------------------------
 scripts/coccinelle/null/deref_null.cocci |  293 ++++++++++++++++++++++++++++++
 2 files changed, 293 insertions(+), 293 deletions(-)
 delete mode 100644 scripts/coccinelle/deref_null.cocci
 create mode 100644 scripts/coccinelle/null/deref_null.cocci

diff --git a/scripts/coccinelle/deref_null.cocci b/scripts/coccinelle/deref_null.cocci
deleted file mode 100644
index 9969d76..0000000
--- a/scripts/coccinelle/deref_null.cocci
+++ /dev/null
@@ -1,293 +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 patch
-virtual org
-virtual report
-
-@...tialize:python depends on !context && patch && !org && !report@
-
-import sys
-print >> sys.stderr, "This semantic patch does not support the 'patch' mode."
-
-@...ends on patch@
-@@
-
-this_rule_should_never_matches();
-
-@ifm depends on !patch@
-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 depends on !patch expression@
-expression *ifm.E;
-identifier f;
-position p1;
-@@
-
- (E != NULL && ...) ? <+...E->f@.....+> : ...
-
-@pr2 depends on !patch expression@
-expression *ifm.E;
-identifier f;
-position p2;
-@@
-
-(
-  (E != NULL) && ... && <+...E->f@.....+>
-|
-  (E == NULL) || ... || <+...E->f@.....+>
-|
- sizeof(<+...E->f@.....+>)
-)
-
-// For org and report modes
-
-@r depends on !context && !patch && (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
-
-@...ipt:python depends on !context && !patch && !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)
-
-@...ipt:python depends on !context && !patch && 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 && !patch && (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
-
-@...ipt:python depends on !context && !patch && !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)
-
-@...ipt:python depends on !context && !patch && 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
-
-@...ends on context && !patch && !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".
-
-@...1 depends on !patch@
-expression *E;
-statement S1,S2;
-position p1;
-@@
-
-if@p1 ((E == NULL && ...) || ...) S1 else S2
-
-@...1 depends on !patch expression@
-expression *ifm1.E;
-identifier f;
-position p1;
-@@
-
- (E != NULL && ...) ? <+...E->f@.....+> : ...
-
-@...2 depends on !patch expression@
-expression *ifm1.E;
-identifier f;
-position p2;
-@@
-
-(
-  (E != NULL) && ... && <+...E->f@.....+>
-|
-  (E == NULL) || ... || <+...E->f@.....+>
-|
- sizeof(<+...E->f@.....+>)
-)
-
-@...ends on context && !patch && !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/scripts/coccinelle/null/deref_null.cocci b/scripts/coccinelle/null/deref_null.cocci
new file mode 100644
index 0000000..9969d76
--- /dev/null
+++ b/scripts/coccinelle/null/deref_null.cocci
@@ -0,0 +1,293 @@
+///
+/// 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 patch
+virtual org
+virtual report
+
+@...tialize:python depends on !context && patch && !org && !report@
+
+import sys
+print >> sys.stderr, "This semantic patch does not support the 'patch' mode."
+
+@...ends on patch@
+@@
+
+this_rule_should_never_matches();
+
+@ifm depends on !patch@
+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 depends on !patch expression@
+expression *ifm.E;
+identifier f;
+position p1;
+@@
+
+ (E != NULL && ...) ? <+...E->f@.....+> : ...
+
+@pr2 depends on !patch expression@
+expression *ifm.E;
+identifier f;
+position p2;
+@@
+
+(
+  (E != NULL) && ... && <+...E->f@.....+>
+|
+  (E == NULL) || ... || <+...E->f@.....+>
+|
+ sizeof(<+...E->f@.....+>)
+)
+
+// For org and report modes
+
+@r depends on !context && !patch && (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
+
+@...ipt:python depends on !context && !patch && !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)
+
+@...ipt:python depends on !context && !patch && 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 && !patch && (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
+
+@...ipt:python depends on !context && !patch && !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)
+
+@...ipt:python depends on !context && !patch && 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
+
+@...ends on context && !patch && !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".
+
+@...1 depends on !patch@
+expression *E;
+statement S1,S2;
+position p1;
+@@
+
+if@p1 ((E == NULL && ...) || ...) S1 else S2
+
+@...1 depends on !patch expression@
+expression *ifm1.E;
+identifier f;
+position p1;
+@@
+
+ (E != NULL && ...) ? <+...E->f@.....+> : ...
+
+@...2 depends on !patch expression@
+expression *ifm1.E;
+identifier f;
+position p2;
+@@
+
+(
+  (E != NULL) && ... && <+...E->f@.....+>
+|
+  (E == NULL) || ... || <+...E->f@.....+>
+|
+ sizeof(<+...E->f@.....+>)
+)
+
+@...ends on context && !patch && !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
-- 
1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ