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?
Thanks
-- 
Corentin Chary
http://xf.iksaif.net
_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)

Reply via email to