Re: [Cocci] field access scoping / check who accesses certain struct members ?

2019-11-21 Thread Markus Elfring
> If you want to check on many types and fields, you can use the following rule: > > @@ > identifier virtual.ty; > struct ty x; > identifier virtual.fld; > @@ > > * x.fld > > Then you can run it with the command-line options: > > -D ty=type_of_interest -D fld=field_of_interest This data processing

Re: [Cocci] field access scoping / check who accesses certain struct members ?

2019-11-20 Thread Julia Lawall
On Wed, 20 Nov 2019, Enrico Weigelt, metux IT consult wrote: > Hi folks, > > > is there a way to scan for code lines that access certain struct > members ? @@ struct structure_of_interest x; @@ * x.field_of_interest This will take care of pointers as well. If you want to check on many types

[Cocci] field access scoping / check who accesses certain struct members ?

2019-11-20 Thread Enrico Weigelt, metux IT consult
Hi folks, is there a way to scan for code lines that access certain struct members ? Rationale: In the kernel, we have lots of struct fields (eg. in struct device) which are supposed to be only accessed by certain subsystems. I'd like to add some checks for that by scanning for all sites that a