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] [day] [month] [year] [list]
Message-ID: <9d9a0d3c-e4fd-d950-518a-b567fe18ff21@users.sourceforge.net>
Date:   Wed, 1 Aug 2018 14:30:18 +0200
From:   SF Markus Elfring <elfring@...rs.sourceforge.net>
To:     kernel-janitors@...r.kernel.org,
        Elena Reshetova <elena.reshetova@...el.com>,
        Julia Lawall <julia.lawall@...6.fr>,
        Kees Cook <keescook@...omium.org>,
        Masahiro Yamada <yamada.masahiro@...ionext.com>
Cc:     LKML <linux-kernel@...r.kernel.org>,
        Coccinelle <cocci@...teme.lip6.fr>,
        Gilles Muller <Gilles.Muller@...6.fr>,
        Michal Marek <michal.lkml@...kovi.net>,
        Nicolas Palix <nicolas.palix@...g.fr>
Subject: [PATCH] Coccinelle: atomic_as_refcounter: Merge two SmPL rules

From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Wed, 1 Aug 2018 14:16:01 +0200

Two rules of a script for the semantic patch language displayed
the same message.
Thus reduce duplicate SmPL code so that the desired data processing
is achieved by another nested SmPL disjunction in a single SmPL rule.

Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
 .../coccinelle/api/atomic_as_refcounter.cocci | 50 ++++---------------
 1 file changed, 10 insertions(+), 40 deletions(-)

diff --git a/scripts/coccinelle/api/atomic_as_refcounter.cocci b/scripts/coccinelle/api/atomic_as_refcounter.cocci
index 1e2278ff3261..292a029d5a51 100644
--- a/scripts/coccinelle/api/atomic_as_refcounter.cocci
+++ b/scripts/coccinelle/api/atomic_as_refcounter.cocci
@@ -11,12 +11,11 @@ virtual report
 
 @r1 exists@
 expression a;
-identifier x;
 position p1, p2;
-identifier fname =~ "free";
-identifier fname2 =~ "(?:call_rcu|de(?:l|stroy)|(?:queue|schedule)_work)";
+identifier x, y,
+           fname =~ "free",
+           fname2 =~ "(?:call_rcu|de(?:l|stroy)|(?:queue|schedule)_work)";
 @@
-
 (
 (atomic_dec_and_test@p1
 |atomic_long_dec_and_test@p1
@@ -28,14 +27,17 @@ identifier fname2 =~ "(?:call_rcu|de(?:l|stroy)|(?:queue|schedule)_work)";
 |atomic_long_dec_and_lock@p1
 )                           (&(a)->x, ...)
 )
-...
+ ...
 (
- fname@p2(a, ...);
+(fname@p2(a, ...)
+|fname2@p2(...)
+);
 |
- fname2@p2(...);
+ y = a
+ ...
+ fname@p2(y, ...);
 )
 
-
 @script:python depends on report@
 p1 << r1.p1;
 p2 << r1.p2;
@@ -44,38 +46,6 @@ coccilib.report.print_report(p1[0],
                              "atomic_dec_and_test variation before object free at line %s."
                              % (p2[0].line))
 
-@r4 exists@
-expression a;
-identifier x, y;
-position p1, p2;
-identifier fname =~ "free";
-@@
-
-(
-(atomic_dec_and_test@p1
-|atomic_long_dec_and_test@p1
-|atomic64_dec_and_test@p1
-|local_dec_and_test@p1
-)                           (&(a)->x)
-|
-(atomic_dec_and_lock@p1
-|atomic_long_dec_and_lock@p1
-)                           (&(a)->x, ...)
-)
-...
-y=a
-...
-fname@p2(y, ...);
-
-
-@...ipt:python depends on report@
-p1 << r4.p1;
-p2 << r4.p2;
-@@
-coccilib.report.print_report(p1[0],
-                             "atomic_dec_and_test variation before object free at line %s."
-                             % (p2[0].line))
-
 @r2 exists@
 expression a;
 identifier F =~ "^atomic(?:64|_long)?_add_unless$", x;
-- 
2.18.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ