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