[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f5754bb5-24f6-3bcb-6f20-52f278fe8b70@users.sourceforge.net>
Date: Mon, 1 Aug 2016 14:24:53 +0200
From: SF Markus Elfring <elfring@...rs.sourceforge.net>
To: Julia Lawall <julia.lawall@...6.fr>
Cc: Amitoj Kaur Chawla <amitoj1606@...il.com>,
LKML <linux-kernel@...r.kernel.org>,
Coccinelle <cocci@...teme.lip6.fr>,
Gilles Muller <Gilles.Muller@...6.fr>,
Michal Marek <mmarek@...e.com>,
Nicolas Palix <nicolas.palix@...g.fr>
Subject: Re: [Cocci] [PATCH v3] Coccinelle: Script to replace allocate and
memset with zalloc functions
>> How do you think about the following SmPL script example?
>>
>> @vz_combined
>> depends on patch && !context && !org && !report@
>> type T;
>> T* pointer;
>> +statement S;
>> expression express;
>> @@
>> pointer =
>> - vmalloc
>> + vzalloc
>> (...);
>> if (!d)
>> S
>> -memset(d, 0, sizeof(
>> (
>> -T
>> |
>> -*(express)
>> )
>> -));
>
> OK, I thought you meant to make a big disjunctions for all of the before
> and after functions.
I imagine that it would be nice if the function name pairs could be specified
in a more succinct format for the semantic patch language.
But the discussed approach can work with a recent software version already.
> This is a little better because it is bounded in size.
Thanks …
> But I don't understand why you have introduced the variable express.
I have noticed that these two SmPL rules differed only in the source code
search specification for the operator "sizeof".
So I would prefer to express this small difference in the script directly.
> The performance issue is that disjunctions on expressions, eg (A | B), are
> implemented as (A | (!A & B)), ie with a negation of all the previous
> options &d with each option. So it is better to avoid very large
> disjunctions on expressions.
Is the suggested SmPL disjunction still small enough for this concern?
Regards,
Markus
Powered by blists - more mailing lists