On Mon, 12 Apr 2010, Corentin Chary wrote:

> Hi,
> I was trying to make a patch to match this pattern:
> 
> void foo() {
>     struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
>     acpi_evaluate_object(a, b, c, &buffer);
>     // kfree(buffer.pointer); should be here
> }
> 
> Here is the patch I tried to do,
> 
> // <smpl>
> 
> @r@
> expression E;
> position p;
> @@
> 
> acpi_evaluate_object(..., &E);@p
> ... when != kfree(E.pointer)
> 
> @script:python@
> p << r.p;
> @@
> 
> print "acpi_evaluate_object without kfree: %s %s " % (p[0].file, p[0].line)
> // </spml>
> 
> And here is how I run it.
> 
> spatch  -sp  test.cocci drivers/acpi/battery.c  -debug
> 
> But I can't manage to make it patch anything (I removed a kfree in
> battery.c to test).
> Any idea?

It looks fine to me, and it works fine for me as well.  I get as the 
complete output:

init_defs_builtins: /usr/local/share/coccinelle/standard.h
acpi_evaluate_object without kfree: tests/acpi.c 3 
no modification on the input file

The no modification on the input file just means that nothing was 
modified.  The python code shows that something was matched.

julia
_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)

Reply via email to