]> git.baikalelectronics.ru Git - kernel.git/commit
coccinelle: iterators: Add for_each_child.cocci script
authorSumera Priyadarsini <sylphrenadin@gmail.com>
Thu, 15 Oct 2020 10:51:40 +0000 (16:21 +0530)
committerJulia Lawall <Julia.Lawall@lip6.fr>
Thu, 15 Oct 2020 20:28:10 +0000 (22:28 +0200)
commitb633b108f66b5b93951321f851cfd6fb81eadfd5
tree5d4648fa860e88459fe83573be289063bf5e8b01
parentf69b6d3451ed68dbb131f16dc53496f6a378647d
coccinelle: iterators: Add for_each_child.cocci script

While iterating over child nodes with the for_each functions, if
control is transferred from the middle of the loop, as in the case
of a break or return or goto, there is no decrement in the
reference counter thus ultimately resulting in a memory leak.

Add this script to detect potential memory leaks caused by
the absence of of_node_put() before break, goto, or, return
statements which transfer control outside the loop.

Signed-off-by: Sumera Priyadarsini <sylphrenadin@gmail.com>
Signed-off-by: Julia Lawall <julia.lawall@inria.fr>
scripts/coccinelle/iterators/for_each_child.cocci [new file with mode: 0644]