On 15 June 2014 01:33, Joe Perches <[email protected]> wrote: > On Sun, 2014-06-15 at 01:03 +0530, Himangi Saraogi wrote: > > Hi, > > Hi Himangi. > > > I have run the generic rule but it does not detect the cases of > > cast where the k[mzc]alloc or the kmem functions are used. I have used > > flags like recursive-includes, as suggested by Julia, but not any of the > > cases covered by the original script are detected. > > Odd. > > When I tried it I got things like: > > Thanks for your feedback. Sorry, yes it does detect, I had already sent patches for the files and hence my tree did not have the casts.
> $ cat void.cocci > @@ > void *t; > type other; > @@ > > - (other *)t > + t > > $ spatch --version > spatch version 1.0.0-rc14 without Python support and with PCRE support > > $ spatch --sp-file void.cocci --recursive-includes > drivers/block/cciss_scsi.c > drivers/block/cciss_scsi.c > +++ /tmp/cocci-output-8427-7875f0-cciss_scsi.c > @@ -704,8 +704,7 @@ cciss_scsi_setup(ctlr_info_t *h) > struct cciss_scsi_adapter_data_t * shba; > > ccissscsi[h->ctlr].ndevices = 0; > - shba = (struct cciss_scsi_adapter_data_t *) > - kmalloc(sizeof(*shba), GFP_KERNEL); > + shba = kmalloc(sizeof(*shba), GFP_KERNEL); > if (shba == NULL) > return; > shba->scsi_host = NULL; > > > I'll be extending the patch to handle generic cases. Thanks Himangi
_______________________________________________ Cocci mailing list [email protected] https://systeme.lip6.fr/mailman/listinfo/cocci
