Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1395351 > unrolled thread

Re: [PATCH] Coccinelle: noderef: Add a rule and correct the old rule

Started byJulia Lawall <julia.lawall@lip6.fr>
First post2016-05-05 22:20 +0200
Last post2016-05-06 06:50 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH] Coccinelle: noderef: Add a rule and correct the old  rule Julia Lawall <julia.lawall@lip6.fr> - 2016-05-05 22:20 +0200
    Re: [PATCH] Coccinelle: noderef: Add a rule and correct the old rule Vaishali Thakkar <vaishali.thakkar@oracle.com> - 2016-05-06 06:50 +0200

#1395351 — Re: [PATCH] Coccinelle: noderef: Add a rule and correct the old rule

FromJulia Lawall <julia.lawall@lip6.fr>
Date2016-05-05 22:20 +0200
SubjectRe: [PATCH] Coccinelle: noderef: Add a rule and correct the old rule
Message-ID<rvxUB-6Rk-7@gated-at.bofh.it>

On Wed, 27 Apr 2016, Vaishali Thakkar wrote:

> Add a new rule to detect the cases where sizeof is used as a
> subexpression rather than a top level 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 <vaishali.thakkar@oracle.com>
> ---
>  scripts/coccinelle/misc/noderef.cocci | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/scripts/coccinelle/misc/noderef.cocci b/scripts/coccinelle/misc/noderef.cocci
> index 80a831c..9991ee9 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;
> +identifier i;

I think that i could be an expression in both cases?

julia

>  type T;
>  @@
>  
> @@ -30,7 +31,12 @@ f(...,(T)(x),...,sizeof(
>  + *x
>     ),...)
>  |
> -f(...,sizeof(x),...,(T)(
> +f(...,sizeof(
> +- x
> ++ *x
> +   ),...,(T)(x),...)
> +|
> +x = f(...,i*sizeof(
>  - x
>  + *x
>     ),...)
> @@ -39,6 +45,7 @@ f(...,sizeof(x),...,(T)(
>  @r depends on !patch@
>  expression *x;
>  expression f;
> +identifier i;
>  position p;
>  type T;
>  @@
> @@ -49,6 +56,8 @@ type T;
>  *f(...,(T)(x),...,sizeof@p(x),...)
>  |
>  *f(...,sizeof@p(x),...,(T)(x),...)
> +|
> +*x = f(...,i*sizeof@p(x),...)
>  )
>  
>  @script:python depends on org@
> -- 
> 2.1.4
> 
> 

[toc] | [next] | [standalone]


#1395599 — Re: [PATCH] Coccinelle: noderef: Add a rule and correct the old rule

FromVaishali Thakkar <vaishali.thakkar@oracle.com>
Date2016-05-06 06:50 +0200
SubjectRe: [PATCH] Coccinelle: noderef: Add a rule and correct the old rule
Message-ID<rvFS9-6PL-1@gated-at.bofh.it>
In reply to#1395351

On Friday 06 May 2016 01:40 AM, Julia Lawall wrote:
> 
> 
> On Wed, 27 Apr 2016, Vaishali Thakkar wrote:
> 
>> Add a new rule to detect the cases where sizeof is used as a
>> subexpression rather than a top level 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 <vaishali.thakkar@oracle.com>
>> ---
>>  scripts/coccinelle/misc/noderef.cocci | 11 ++++++++++-
>>  1 file changed, 10 insertions(+), 1 deletion(-)
>>
>> diff --git a/scripts/coccinelle/misc/noderef.cocci b/scripts/coccinelle/misc/noderef.cocci
>> index 80a831c..9991ee9 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;
>> +identifier i;
> 
> I think that i could be an expression in both cases?

Yeah, that would be fine I guess. I'll send the v2.

> julia
> 
>>  type T;
>>  @@
>>  
>> @@ -30,7 +31,12 @@ f(...,(T)(x),...,sizeof(
>>  + *x
>>     ),...)
>>  |
>> -f(...,sizeof(x),...,(T)(
>> +f(...,sizeof(
>> +- x
>> ++ *x
>> +   ),...,(T)(x),...)
>> +|
>> +x = f(...,i*sizeof(
>>  - x
>>  + *x
>>     ),...)
>> @@ -39,6 +45,7 @@ f(...,sizeof(x),...,(T)(
>>  @r depends on !patch@
>>  expression *x;
>>  expression f;
>> +identifier i;
>>  position p;
>>  type T;
>>  @@
>> @@ -49,6 +56,8 @@ type T;
>>  *f(...,(T)(x),...,sizeof@p(x),...)
>>  |
>>  *f(...,sizeof@p(x),...,(T)(x),...)
>> +|
>> +*x = f(...,i*sizeof@p(x),...)
>>  )
>>  
>>  @script:python depends on org@
>> -- 
>> 2.1.4
>>
>>

-- 
Vaishali

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web