Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp6744217yba; Tue, 14 May 2019 12:52:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqyLNTCzJ4wR7sTrg+qjkeQQc/PQMukIRINey2BoJuG+ViWN/vCkTU5pyEZ+SpEQTr04yXd0 X-Received: by 2002:a65:4243:: with SMTP id d3mr29067712pgq.57.1557863539079; Tue, 14 May 2019 12:52:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557863539; cv=none; d=google.com; s=arc-20160816; b=C3bKg0hmoxaRmMYBoZ9GEpYYvigIAb0G4b61w0g1ojhFggBxIzBiEXtXCED4I9Sn5J wRuWcwpI9ieAjKwNPwHUTlsNqM2CgTgZ95PS6KjpxVbalCyDzSfFIGrPOVdHv8dpUvSj S1FUrZZcKKvG1TF2P9QbQCaQy/NyxpslWAPX/QRvVslq90LIX4KTxG/9kwp1tFzMAzo7 H4loMmEIFFHhvx5su5UoI18XOog+UBC75PVJuHhxiHYgvem6aZ4KKsh+bU5IRPx+pjTG dEl3YbXXwvaYNC/Qbd5uwK43aDM5keyZfQhXorvWxLlUIBhyRcBB7eHCmfIgVlrxxNew HV2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=yzPTsWPHjeQ5YB18zBLb7DmbRpfzpvl7pFOslsQCl4I=; b=I7KLT90M3g8U6xJz/nn5izBi1ulga218HrsnO5khA/KxPR9RdgfWWaxkB8i5XQVnxi B79yOXtG80k9/RqTrPqlS6k2EkPrNNs32w+mGFWomkXo3UvbxsB/dEfM/GMccZfAR0TW y7+NPVLhl07BikryFvvhPAKmWk4NV1ZpOSo1zi/0ESwRdX2hBov+kuzCGJ7uUiBJR733 F3nXpmyhNLZUKqlbABNL5KFLsuudJe0f9Fz2C8SOKZ1Yp00yHF1lgo+47DtZRnaoiDRK 9B6z2OKSX1xnyGXo4xTa2DVJOk1vPSnILqMbwNxIvO9FK09A/gyEmce+73P56NUQG0c0 lizQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r140si20041709pgr.585.2019.05.14.12.52.04; Tue, 14 May 2019 12:52:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726363AbfENTuz (ORCPT + 99 others); Tue, 14 May 2019 15:50:55 -0400 Received: from mail3-relais-sop.national.inria.fr ([192.134.164.104]:62392 "EHLO mail3-relais-sop.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726036AbfENTuz (ORCPT ); Tue, 14 May 2019 15:50:55 -0400 X-IronPort-AV: E=Sophos;i="5.60,469,1549926000"; d="scan'208";a="306019357" Received: from abo-218-110-68.mrs.modulonet.fr (HELO hadrien) ([85.68.110.218]) by mail3-relais-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 May 2019 21:50:52 +0200 Date: Tue, 14 May 2019 21:50:52 +0200 (CEST) From: Julia Lawall X-X-Sender: jll@hadrien To: Markus Elfring cc: Gilles Muller , Masahiro Yamada , Michal Marek , Nicolas Palix , Wen Yang , Coccinelle , LKML , Yi Wang Subject: Re: [PATCH 3/3] Coccinelle: pci_free_consistent: Extend when constraints for two SmPL ellipses In-Reply-To: Message-ID: References: User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 14 May 2019, Markus Elfring wrote: > From: Markus Elfring > 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. I leave this up to the ZTE people. julia > > Fixes: f7b167113753e95ae61383e234f8d10142782ace ("scripts: Coccinelle script for pci_free_consistent()") > Signed-off-by: Markus Elfring > --- > 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 > >