kfreeaddr.cocci 646 B

12345678910111213141516171819202122232425262728293031323334353637
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /// Free of a structure field
  3. ///
  4. // Confidence: High
  5. // Copyright: (C) 2013 Julia Lawall, INRIA/LIP6.
  6. // URL: https://coccinelle.gitlabpages.inria.fr/website
  7. // Comments:
  8. // Options: --no-includes --include-headers
  9. virtual org
  10. virtual report
  11. virtual context
  12. @r depends on context || report || org @
  13. expression e;
  14. identifier f;
  15. position p;
  16. @@
  17. (
  18. * kfree@p(&e->f)
  19. |
  20. * kfree_sensitive@p(&e->f)
  21. )
  22. @script:python depends on org@
  23. p << r.p;
  24. @@
  25. cocci.print_main("kfree",p)
  26. @script:python depends on report@
  27. p << r.p;
  28. @@
  29. msg = "ERROR: invalid free of structure field"
  30. coccilib.report.print_report(p[0],msg)