hc
2024-05-10 9999e48639b3cecb08ffb37358bcba3b48161b29
kernel/scripts/coccinelle/iterators/use_after_iter.cocci
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /// If list_for_each_entry, etc complete a traversal of the list, the iterator
23 /// variable ends up pointing to an address at an offset from the list head,
34 /// and not a meaningful structure. Thus this value should not be used after
....@@ -7,8 +8,8 @@
78 //#may also cause a report to be a false positive.
89 ///
910 // Confidence: Moderate
10
-// Copyright: (C) 2012 Julia Lawall, INRIA/LIP6. GPLv2.
11
-// Copyright: (C) 2012 Gilles Muller, INRIA/LIP6. GPLv2.
11
+// Copyright: (C) 2012 Julia Lawall, INRIA/LIP6.
12
+// Copyright: (C) 2012 Gilles Muller, INRIA/LIP6.
1213 // URL: http://coccinelle.lip6.fr/
1314 // Comments:
1415 // Options: --no-includes --include-headers
....@@ -35,6 +36,7 @@
3536 iterator name hlist_for_each_entry_safe;
3637 statement S;
3738 position p1,p2;
39
+type T;
3840 @@
3941
4042 (
....@@ -125,6 +127,8 @@
125127 |
126128 &c->member
127129 |
130
+T c;
131
+|
128132 c = E
129133 |
130134 *c@p2