summaryrefslogtreecommitdiff
path: root/scripts/coccinelle/iterators/use_after_iter.cocci
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/coccinelle/iterators/use_after_iter.cocci')
-rw-r--r--scripts/coccinelle/iterators/use_after_iter.cocci12
1 files changed, 9 insertions, 3 deletions
diff --git a/scripts/coccinelle/iterators/use_after_iter.cocci b/scripts/coccinelle/iterators/use_after_iter.cocci
index ce8cc9c006e5..f67110ba7290 100644
--- a/scripts/coccinelle/iterators/use_after_iter.cocci
+++ b/scripts/coccinelle/iterators/use_after_iter.cocci
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
/// If list_for_each_entry, etc complete a traversal of the list, the iterator
/// variable ends up pointing to an address at an offset from the list head,
/// and not a meaningful structure. Thus this value should not be used after
@@ -7,9 +8,9 @@
//#may also cause a report to be a false positive.
///
// Confidence: Moderate
-// Copyright: (C) 2012 Julia Lawall, INRIA/LIP6. GPLv2.
-// Copyright: (C) 2012 Gilles Muller, INRIA/LIP6. GPLv2.
-// URL: http://coccinelle.lip6.fr/
+// Copyright: (C) 2012 Julia Lawall, INRIA/LIP6.
+// Copyright: (C) 2012 Gilles Muller, INRIA/LIP6.
+// URL: https://coccinelle.gitlabpages.inria.fr/website
// Comments:
// Options: --no-includes --include-headers
@@ -35,6 +36,7 @@ iterator name hlist_for_each_entry_from;
iterator name hlist_for_each_entry_safe;
statement S;
position p1,p2;
+type T;
@@
(
@@ -121,10 +123,14 @@ hlist_for_each_entry_safe(c,...) S
|
list_remove_head(x,c,...)
|
+list_entry_is_head(c,...)
+|
sizeof(<+...c...+>)
|
&c->member
|
+T c;
+|
c = E
|
*c@p2