Skip to content

Commit

Permalink
[PATCH] list_del debug check
Browse files Browse the repository at this point in the history
A list_del() debugging check.  Has been in -mm for years.  Dave moved
list_del() out-of-line in the debug case, so this is now suitable for
mainline.

Cc: Dave Jones <davej@codemonkey.org.uk>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Manfred Spraul authored and Linus Torvalds committed Sep 29, 2006
1 parent 199a9af commit df89a86
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/list_debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,19 +59,21 @@ EXPORT_SYMBOL(list_add);
*/
void list_del(struct list_head *entry)
{
BUG_ON(entry->prev->next != entry);
BUG_ON(entry->next->prev != entry);

if (unlikely(entry->prev->next != entry)) {
printk(KERN_ERR "list_del corruption. prev->next should be %p, but was %p\n",
entry, entry->prev->next);
printk(KERN_ERR "list_del corruption. prev->next should be %p, "
"but was %p\n", entry, entry->prev->next);
BUG();
}
if (unlikely(entry->next->prev != entry)) {
printk(KERN_ERR "list_del corruption. next->prev should be %p, but was %p\n",
entry, entry->next->prev);
printk(KERN_ERR "list_del corruption. next->prev should be %p, "
"but was %p\n", entry, entry->next->prev);
BUG();
}
__list_del(entry->prev, entry->next);
entry->next = LIST_POISON1;
entry->prev = LIST_POISON2;
}
EXPORT_SYMBOL(list_del);

0 comments on commit df89a86

Please sign in to comment.