linux/scripts/coccinelle
Daniel Thompson e71ec0bc06 scripts: coccinelle: allow list_entry_is_head() to use pos
Currently use_after_iter.cocci generates false positives for code of the
following form:
~~~
	list_for_each_entry(d, &ddata->irq_list, node) {
		if (irq == d->irq)
			break;
	}

	if (list_entry_is_head(d, &ddata->irq_list, node))
		return IRQ_NONE;
~~~
[This specific example comes from drivers/power/supply/cpcap-battery.c]

Most list macros use list_entry_is_head() as loop exit condition meaning it
is not unsafe to reuse pos (a.k.a. d) in the code above.

Let's avoid reporting these cases.

Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
2021-08-08 22:00:49 +02:00
..
api coccinelle: api: rename kzfree to kfree_sensitive 2021-08-05 13:01:09 +02:00
free drop unneeded *s 2021-05-01 21:23:57 +02:00
iterators scripts: coccinelle: allow list_entry_is_head() to use pos 2021-08-08 22:00:49 +02:00
locks treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 505 2019-06-19 17:11:22 +02:00
misc coccinelle: misc: minmax: suppress patch generation for err returns 2021-05-01 21:27:10 +02:00
null treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 505 2019-06-19 17:11:22 +02:00
tests treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 505 2019-06-19 17:11:22 +02:00