[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1341747464-1772-1-git-send-email-Julia.Lawall@lip6.fr>
Date: Sun, 8 Jul 2012 13:37:37 +0200
From: Julia Lawall <Julia.Lawall@...6.fr>
To: linux-kernel@...r.kernel.org
Cc: kernel-janitors@...r.kernel.org
Subject: [PATCH 0/7] remove invalid reference to list iterator variable
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
the end of the iterator.
The complete semantic match that finds this problem is:
(http://coccinelle.lip6.fr/)
@@
identifier c,member;
expression E,x;
iterator name list_for_each_entry;
iterator name list_for_each_entry_reverse;
iterator name list_for_each_entry_continue;
iterator name list_for_each_entry_continue_reverse;
iterator name list_for_each_entry_from;
iterator name list_for_each_entry_safe;
iterator name list_for_each_entry_safe_continue;
iterator name list_for_each_entry_safe_from;
iterator name list_for_each_entry_safe_reverse;
iterator name hlist_for_each_entry;
iterator name hlist_for_each_entry_continue;
iterator name hlist_for_each_entry_from;
iterator name hlist_for_each_entry_safe;
statement S;
@@
(
list_for_each_entry(c,...,member) { ... when != break;
when forall
when strict
}
|
list_for_each_entry_reverse(c,...,member) { ... when != break;
when forall
when strict
}
|
list_for_each_entry_continue(c,...,member) { ... when != break;
when forall
when strict
}
|
list_for_each_entry_continue_reverse(c,...,member) { ... when != break;
when forall
when strict
}
|
list_for_each_entry_from(c,...,member) { ... when != break;
when forall
when strict
}
|
list_for_each_entry_safe(c,...,member) { ... when != break;
when forall
when strict
}
|
list_for_each_entry_safe_continue(c,...,member) { ... when != break;
when forall
when strict
}
|
list_for_each_entry_safe_from(c,...,member) { ... when != break;
when forall
when strict
}
|
list_for_each_entry_safe_reverse(c,...,member) { ... when != break;
when forall
when strict
}
)
...
(
list_for_each_entry(c,...) S
|
list_for_each_entry_reverse(c,...) S
|
list_for_each_entry_continue(c,...) S
|
list_for_each_entry_continue_reverse(c,...) S
|
list_for_each_entry_from(c,...) S
|
list_for_each_entry_safe(c,...) S
|
list_for_each_entry_safe(x,c,...) S
|
list_for_each_entry_safe_continue(c,...) S
|
list_for_each_entry_safe_continue(x,c,...) S
|
list_for_each_entry_safe_from(c,...) S
|
list_for_each_entry_safe_from(x,c,...) S
|
list_for_each_entry_safe_reverse(c,...) S
|
list_for_each_entry_safe_reverse(x,c,...) S
|
hlist_for_each_entry(c,...) S
|
hlist_for_each_entry_continue(c,...) S
|
hlist_for_each_entry_from(c,...) S
|
hlist_for_each_entry_safe(c,...) S
|
list_remove_head(x,c,...)
|
sizeof(<+...c...+>)
|
&c->member
|
c = E
|
*c
)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists