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]
Message-ID: <c4e9153c-234e-ab5a-0061-221374c2505b@web.de>
Date:   Tue, 14 May 2019 18:52:52 +0200
From:   Markus Elfring <Markus.Elfring@....de>
To:     Gilles Muller <Gilles.Muller@...6.fr>,
        Julia Lawall <Julia.Lawall@...6.fr>,
        Masahiro Yamada <yamada.masahiro@...ionext.com>,
        Michal Marek <michal.lkml@...kovi.net>,
        Nicolas Palix <nicolas.palix@...g.fr>,
        Wen Yang <wen.yang99@....com.cn>
Cc:     Coccinelle <cocci@...teme.lip6.fr>,
        LKML <linux-kernel@...r.kernel.org>,
        Yi Wang <wang.yi59@....com.cn>
Subject: [PATCH 3/3] Coccinelle: pci_free_consistent: Extend when constraints
 for two SmPL ellipses

From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Tue, 14 May 2019 18:12:15 +0200

A SmPL ellipsis was specified for a search approach so that additional
source code would be tolerated between an assignment to a local variable
and the corresponding null pointer check.

But such code should be restricted.
* The local variable must not be reassigned there.
* It must also not be forwarded to an other assignment target.

Take additional casts for these code exclusion specifications into account
together with optional parentheses.

Fixes: f7b167113753e95ae61383e234f8d10142782ace ("scripts: Coccinelle script for pci_free_consistent()")
Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
 scripts/coccinelle/free/pci_free_consistent.cocci | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/scripts/coccinelle/free/pci_free_consistent.cocci b/scripts/coccinelle/free/pci_free_consistent.cocci
index 45bc14ece151..48a36adfa3ce 100644
--- a/scripts/coccinelle/free/pci_free_consistent.cocci
+++ b/scripts/coccinelle/free/pci_free_consistent.cocci
@@ -13,13 +13,15 @@ virtual org
 local idexpression id;
 expression x,y,z,e;
 position p1,p2;
-type T;
+type T,T2,T3,T4;
 @@

 id = pci_alloc_consistent@p1(x,y,&z)
-... when != e = id
+ ... when != id = (T2)(e)
+     when != e = (T3)(id)
 if (id == NULL || ...) { ... return ...; }
 ... when != pci_free_consistent(x,y,id,z)
+    when != id = (T4)(e)
     when != if (id) { ... pci_free_consistent(x,y,id,z) ... }
     when != if (y) { ... pci_free_consistent(x,y,id,z) ... }
     when != e = (T)id
--
2.21.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ