[Cocci] [PATCH 01/31] coccinelle: Improve setup_timer.cocci matching

2017-08-31 Thread Kees Cook
This improves the patch mode of setup_timer.cocci. Several patterns were missing: - assignments-before-init_timer() cases - limit the .data case removal to the specific struct timer_list instance - handling calls by dereference (timer->field vs timer.field) Cc: Julia Lawall

Re: [Cocci] cocci script to add static to const declarations ?

2017-08-31 Thread Joe Perches
On Thu, 2017-08-31 at 21:25 +0200, Julia Lawall wrote: > On Thu, 31 Aug 2017, Joe Perches wrote: > > On Thu, 2017-08-31 at 16:22 +0200, Julia Lawall wrote: > > > On Wed, 30 Aug 2017, Joe Perches wrote: > > > > fyi: This doesn't find const structs that could be static. > > > > > > > > Things like:

Re: [Cocci] cocci script to add static to const declarations ?

2017-08-31 Thread Julia Lawall
On Thu, 31 Aug 2017, Joe Perches wrote: > On Thu, 2017-08-31 at 16:22 +0200, Julia Lawall wrote: > > On Wed, 30 Aug 2017, Joe Perches wrote: > > > fyi: This doesn't find const structs that could be static. > > > > > > Things like: drivers/gpu/drm/i915/selftests/i915_vma.c > > > [] > > > static

Re: [Cocci] cocci script to add static to const declarations ?

2017-08-31 Thread Joe Perches
On Thu, 2017-08-31 at 16:22 +0200, Julia Lawall wrote: > On Wed, 30 Aug 2017, Joe Perches wrote: > > fyi: This doesn't find const structs that could be static. > > > > Things like: drivers/gpu/drm/i915/selftests/i915_vma.c > > [] > > static int igt_vma_rotate(void *arg) > > { > > [] > > const

Re: [Cocci] OpenLDAP debug statements

2017-08-31 Thread Julia Lawall
On Thu, 31 Aug 2017, Ondřej Kuzník wrote: > On Thu, Aug 31, 2017 at 06:01:07PM +0200, Julia Lawall wrote: > > On Thu, 31 Aug 2017, Ondřej Kuzník wrote: > >> On Thu, Aug 31, 2017 at 05:52:14PM +0200, Julia Lawall wrote: > >>> So you want to drop the braces if there is no comment and keep the

Re: [Cocci] OpenLDAP debug statements

2017-08-31 Thread Julia Lawall
On Thu, 31 Aug 2017, Ondřej Kuzník wrote: > On Thu, Aug 31, 2017 at 04:09:30PM +0200, Julia Lawall wrote: > > The problem is in the rule shortcut_replace. You have: > > > > [...] > > > > There are three case (1, 2, and 3). Normally a disjunction like this > > matches from top to bottom, ie if

Re: [Cocci] OpenLDAP debug statements

2017-08-31 Thread Ondřej Kuzník
On Thu, Aug 31, 2017 at 04:09:30PM +0200, Julia Lawall wrote: > The problem is in the rule shortcut_replace. You have: > > [...] > > There are three case (1, 2, and 3). Normally a disjunction like this > matches from top to bottom, ie if the first case matches the ohers are not > considered.

Re: [Cocci] cocci script to add static to const declarations ?

2017-08-31 Thread Julia Lawall
On Wed, 30 Aug 2017, Joe Perches wrote: > On Wed, 2017-08-30 at 23:41 +0200, Julia Lawall wrote: > > New version. > > Thanks. > > fyi: This doesn't find const structs that could be static. > > Things like: drivers/gpu/drm/i915/selftests/i915_vma.c > [] > static int igt_vma_rotate(void *arg) > {

Re: [Cocci] OpenLDAP debug statements

2017-08-31 Thread Julia Lawall
The problem is in the rule shortcut_replace. You have: ( -{ -\( T buf = {...}; \| T buf = I; \| T buf; \| \) -snprintf@p1( buf, E, format1, args ); -Debug@p2( L, format2, args_before, buf, args_after ); +Debug( L, merged, args_before, args, args_after ); -} | { -\( T buf = {...}; \| T buf = I;

Re: [Cocci] OpenLDAP debug statements

2017-08-31 Thread Ondřej Kuzník
On Wed, Aug 30, 2017 at 03:05:04PM +0200, Julia Lawall wrote: > On Wed, 30 Aug 2017, Ondřej Kuzník wrote: >> OK, I understand. I any case, the suggestion below has very few false >> negatives and no false positives that I could find, thanks a lot! >> >> The only false negatives are related to

Re: [Cocci] [PATCH v3 0/5] bq27xxx_battery data memory update

2017-08-31 Thread Liam Breck
On Thu, Aug 31, 2017 at 4:33 AM, Julia Lawall wrote: > > > On Thu, 31 Aug 2017, Liam Breck wrote: > >> On Thu, Aug 31, 2017 at 2:54 AM, Julia Lawall wrote: >> > >> > >> > On Tue, 29 Aug 2017, Liam Breck wrote: >> > >> >> Coccinelle folks, >> >> >> >>

Re: [Cocci] [PATCH v3 0/5] bq27xxx_battery data memory update

2017-08-31 Thread Julia Lawall
On Thu, 31 Aug 2017, Liam Breck wrote: > On Thu, Aug 31, 2017 at 2:54 AM, Julia Lawall wrote: > > > > > > On Tue, 29 Aug 2017, Liam Breck wrote: > > > >> Coccinelle folks, > >> > >> On Tue, Aug 29, 2017 at 5:29 PM, Sebastian Reichel > >>

Re: [Cocci] [PATCH v3 0/5] bq27xxx_battery data memory update

2017-08-31 Thread Liam Breck
On Thu, Aug 31, 2017 at 2:54 AM, Julia Lawall wrote: > > > On Tue, 29 Aug 2017, Liam Breck wrote: > >> Coccinelle folks, >> >> On Tue, Aug 29, 2017 at 5:29 PM, Sebastian Reichel >> wrote: >> > Hi, >> > >> > On Tue, Aug 29, 2017 at

Re: [Cocci] [PATCH v3 0/5] bq27xxx_battery data memory update

2017-08-31 Thread Julia Lawall
On Tue, 29 Aug 2017, Liam Breck wrote: > Coccinelle folks, > > On Tue, Aug 29, 2017 at 5:29 PM, Sebastian Reichel > wrote: > > Hi, > > > > On Tue, Aug 29, 2017 at 04:07:12PM -0700, Liam Breck wrote: > >> I don't see a Julia in CC list... > > > > <_< let's try

Re: [Cocci] [PATCH] Coccinelle: add atomic_as_refcounter script

2017-08-31 Thread Reshetova, Elena
> On Wed, 30 Aug 2017, Reshetova, Elena wrote: > > > > > > > > > On Wed, 30 Aug 2017, Elena Reshetova wrote: > > > > > > > atomic_as_refcounter.cocci script allows detecting > > > > cases when refcount_t type and API should be used > > > > instead of atomic_t. > > > > > > > > Signed-off-by: Elena