[alsa-devel] Misuses of ** ? (was Re: [PATCH 1/1] ASoC: Intel: Atom: add a missing star in a memcpy call)

Joe Perches joe at perches.com
Sun Aug 28 22:34:13 CEST 2016


On Sun, 2016-08-28 at 21:38 +0200, Julia Lawall wrote:
> On Sun, 28 Aug 2016, Nicolas Iooss wrote:
> > On 28/08/16 19:50, Joe Perches wrote:
> > > On Sun, 2016-08-28 at 19:39 +0200, Nicolas Iooss wrote:
> > >> In sst_prepare_and_post_msg(), when a response is received in "block",
> > >> the following code gets executed:
> > >>
> > >>     *data = kzalloc(block->size, GFP_KERNEL);
> > >>     memcpy(data, (void *) block->data, block->size);
> > >
> > > Yuck, thanks.
> > >
> > > Julia, Dan, could cocci or smatch help find any other
> > > similar misuses here?
[]
> I tried the following semantic patch, that is quite general, and the fixed
> issue was the only report.
> 
> @@
> expression x,y,sz;
> identifier f,g;
> @@
> 
> * *x = f(sz,...);
>   ...
> * g(x,y,sz);

Hi Julia,

This would find exactly the same form, but I think
the question is are there assignments of a **pp
that should have been *pp

Something like:

@@
type P;
P **pp;
@@

* pp = <alloc>\|<copy>\|<access>(..., sizeof(P), ...)



More information about the Alsa-devel mailing list