Commit df89a864631f5d840f4873c4c03733b4206e78ea
Committed by
Linus Torvalds
1 parent
199a9afc3d
Exists in
master
and in
7 other branches
[PATCH] list_del debug check
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>
Showing 1 changed file with 7 additions and 5 deletions Side-by-side Diff
lib/list_debug.c
... | ... | @@ -59,14 +59,17 @@ |
59 | 59 | */ |
60 | 60 | void list_del(struct list_head *entry) |
61 | 61 | { |
62 | + BUG_ON(entry->prev->next != entry); | |
63 | + BUG_ON(entry->next->prev != entry); | |
64 | + | |
62 | 65 | if (unlikely(entry->prev->next != entry)) { |
63 | - printk(KERN_ERR "list_del corruption. prev->next should be %p, but was %p\n", | |
64 | - entry, entry->prev->next); | |
66 | + printk(KERN_ERR "list_del corruption. prev->next should be %p, " | |
67 | + "but was %p\n", entry, entry->prev->next); | |
65 | 68 | BUG(); |
66 | 69 | } |
67 | 70 | if (unlikely(entry->next->prev != entry)) { |
68 | - printk(KERN_ERR "list_del corruption. next->prev should be %p, but was %p\n", | |
69 | - entry, entry->next->prev); | |
71 | + printk(KERN_ERR "list_del corruption. next->prev should be %p, " | |
72 | + "but was %p\n", entry, entry->next->prev); | |
70 | 73 | BUG(); |
71 | 74 | } |
72 | 75 | __list_del(entry->prev, entry->next); |