From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754724AbcEXIjG (ORCPT ); Tue, 24 May 2016 04:39:06 -0400 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:46349 "EHLO mail2-relais-roc.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754323AbcEXIjF (ORCPT ); Tue, 24 May 2016 04:39:05 -0400 X-IronPort-AV: E=Sophos;i="5.26,359,1459807200"; d="scan'208";a="219469551" Date: Tue, 24 May 2016 10:39:01 +0200 (CEST) From: Julia Lawall X-X-Sender: jll@hadrien To: Vaishali Thakkar cc: Gilles Muller , nicolas.palix@imag.fr, mmarek@suse.com, cocci@systeme.lip6.fr, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3] Coccinelle: noderef: Add new rules and correct the old rule In-Reply-To: <1464063557-5176-1-git-send-email-vaishali.thakkar@oracle.com> Message-ID: References: <1464063557-5176-1-git-send-email-vaishali.thakkar@oracle.com> User-Agent: Alpine 2.10 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Acked-by: Julia Lawall On Tue, 24 May 2016, Vaishali Thakkar wrote: > Add new rules to detect the cases where sizeof is used in > function calls as a argument. > > Also, for the patch mode third rule should behave same as > second rule with arguments reversed. So, change that as well. > > Signed-off-by: Vaishali Thakkar > --- > Changes since v2: > - Add rules for function calls. This will behave as > more general rules and covers cases which were > covered by the rule in previous versions of the patch > - Change subject and commit log accordingly. > Changes since v1: > - Declare i as an expression instead of identifier to > cover more cases > --- > scripts/coccinelle/misc/noderef.cocci | 18 +++++++++++++++++- > 1 file changed, 17 insertions(+), 1 deletion(-) > > diff --git a/scripts/coccinelle/misc/noderef.cocci b/scripts/coccinelle/misc/noderef.cocci > index 80a831c..007f0de 100644 > --- a/scripts/coccinelle/misc/noderef.cocci > +++ b/scripts/coccinelle/misc/noderef.cocci > @@ -16,6 +16,7 @@ virtual patch > @depends on patch@ > expression *x; > expression f; > +expression i; > type T; > @@ > > @@ -30,15 +31,26 @@ f(...,(T)(x),...,sizeof( > + *x > ),...) > | > -f(...,sizeof(x),...,(T)( > +f(...,sizeof( > +- x > ++ *x > + ),...,(T)(x),...) > +| > +f(...,(T)(x),...,i*sizeof( > - x > + *x > ),...) > +| > +f(...,i*sizeof( > +- x > ++ *x > + ),...,(T)(x),...) > ) > > @r depends on !patch@ > expression *x; > expression f; > +expression i; > position p; > type T; > @@ > @@ -49,6 +61,10 @@ type T; > *f(...,(T)(x),...,sizeof@p(x),...) > | > *f(...,sizeof@p(x),...,(T)(x),...) > +| > +*f(...,(T)(x),...,i*sizeof@p(x),...) > +| > +*f(...,i*sizeof@p(x),...,(T)(x),...) > ) > > @script:python depends on org@ > -- > 2.1.4 > >