On Thu, 31 Oct 2019, Markus Elfring wrote: > > Unfortunately, I stumble on the error message “replacement: already tagged token: > > C code context” then. This is what I would expect. You could use one rule with an exists to put a position variable in the place where you want to put a kfree, and then use another rule to put a kfree at that position. julia > > It might be that the transformation approach was too generic for > the implementation of the function “megasas_mgmt_ioctl_fw”. > https://elixir.bootlin.com/linux/v5.4-rc5/source/drivers/scsi/megaraid/megaraid_sas_base.c#L8258 > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/scsi/megaraid/megaraid_sas_base.c?id=e472c64aa4fa6150c6076fd36d101d667d71c30a#n8258 > > The following SmPL script variant can generate an usable test result. > > @replacement@ > expression result; > identifier work; > type t != void; > @@ > t work(...) > { > <+... > if (...) > ( > -{ > -result = -ENODEV; > goto > - out_kfree_ioc > + e_nodev > ; > -} > | > { > ... > -result = -ENODEV; > goto > - out_kfree_ioc > + e_nodev > ; > } > ) > ...+> > out_kfree_ioc: > ... when exists > return result; > +e_nodev: > +result = -ENODEV; > +goto out_kfree_ioc; > } > > > Regards, > Markus > _______________________________________________ > Cocci mailing list > Cocci@systeme.lip6.fr > https://systeme.lip6.fr/mailman/listinfo/cocci >