* [PATCH] list debugging: warn when deleting a deleted entry
@ 2010-05-05 8:14 Baruch Siach
2010-05-16 5:45 ` Baruch Siach
0 siblings, 1 reply; 3+ messages in thread
From: Baruch Siach @ 2010-05-05 8:14 UTC (permalink / raw)
To: Dave Jones; +Cc: linux-kernel, Baruch Siach
Use the magic LIST_POISON* values to detect an incorrect use of list_del on a
deleted entry. This DEBUG_LIST specific warning is easier to understand than
the generic Oops message caused by LIST_POISON dereference.
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
---
lib/list_debug.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/lib/list_debug.c b/lib/list_debug.c
index 1a39f4e..344c710 100644
--- a/lib/list_debug.c
+++ b/lib/list_debug.c
@@ -43,6 +43,12 @@ EXPORT_SYMBOL(__list_add);
*/
void list_del(struct list_head *entry)
{
+ WARN(entry->next == LIST_POISON1,
+ "list_del corruption, next is LIST_POISON1 (%p)\n",
+ LIST_POISON1);
+ WARN(entry->next != LIST_POISON1 && entry->prev == LIST_POISON2,
+ "list_del corruption, prev is LIST_POISON2 (%p)\n",
+ LIST_POISON2);
WARN(entry->prev->next != entry,
"list_del corruption. prev->next should be %p, "
"but was %p\n", entry, entry->prev->next);
--
1.7.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] list debugging: warn when deleting a deleted entry
2010-05-05 8:14 [PATCH] list debugging: warn when deleting a deleted entry Baruch Siach
@ 2010-05-16 5:45 ` Baruch Siach
0 siblings, 0 replies; 3+ messages in thread
From: Baruch Siach @ 2010-05-16 5:45 UTC (permalink / raw)
To: Dave Jones; +Cc: linux-kernel, Andrew Morton
Hi Dave,
Ping?
Any comment on this?
baruch
On Wed, May 05, 2010 at 11:14:29AM +0300, Baruch Siach wrote:
> Use the magic LIST_POISON* values to detect an incorrect use of list_del on a
> deleted entry. This DEBUG_LIST specific warning is easier to understand than
> the generic Oops message caused by LIST_POISON dereference.
>
> Signed-off-by: Baruch Siach <baruch@tkos.co.il>
> ---
> lib/list_debug.c | 6 ++++++
> 1 files changed, 6 insertions(+), 0 deletions(-)
>
> diff --git a/lib/list_debug.c b/lib/list_debug.c
> index 1a39f4e..344c710 100644
> --- a/lib/list_debug.c
> +++ b/lib/list_debug.c
> @@ -43,6 +43,12 @@ EXPORT_SYMBOL(__list_add);
> */
> void list_del(struct list_head *entry)
> {
> + WARN(entry->next == LIST_POISON1,
> + "list_del corruption, next is LIST_POISON1 (%p)\n",
> + LIST_POISON1);
> + WARN(entry->next != LIST_POISON1 && entry->prev == LIST_POISON2,
> + "list_del corruption, prev is LIST_POISON2 (%p)\n",
> + LIST_POISON2);
> WARN(entry->prev->next != entry,
> "list_del corruption. prev->next should be %p, "
> "but was %p\n", entry, entry->prev->next);
> --
> 1.7.0
>
--
~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch@tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] list debugging: warn when deleting a deleted entry
@ 2010-07-15 11:51 Baruch Siach
0 siblings, 0 replies; 3+ messages in thread
From: Baruch Siach @ 2010-07-15 11:51 UTC (permalink / raw)
To: linux-kernel; +Cc: Andrew Morton, Dave Jones, Baruch Siach
Use the magic LIST_POISON* values to detect an incorrect use of list_del on a
deleted entry. This DEBUG_LIST specific warning is easier to understand than
the generic Oops message caused by LIST_POISON dereference.
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
---
Posting this again.
This patch could have saved me an hour or so. I guess it can be usefull to
others as well. Please pick this up.
lib/list_debug.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/lib/list_debug.c b/lib/list_debug.c
index 1a39f4e..344c710 100644
--- a/lib/list_debug.c
+++ b/lib/list_debug.c
@@ -43,6 +43,12 @@ EXPORT_SYMBOL(__list_add);
*/
void list_del(struct list_head *entry)
{
+ WARN(entry->next == LIST_POISON1,
+ "list_del corruption, next is LIST_POISON1 (%p)\n",
+ LIST_POISON1);
+ WARN(entry->next != LIST_POISON1 && entry->prev == LIST_POISON2,
+ "list_del corruption, prev is LIST_POISON2 (%p)\n",
+ LIST_POISON2);
WARN(entry->prev->next != entry,
"list_del corruption. prev->next should be %p, "
"but was %p\n", entry, entry->prev->next);
--
1.7.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-07-15 11:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-05-05 8:14 [PATCH] list debugging: warn when deleting a deleted entry Baruch Siach
2010-05-16 5:45 ` Baruch Siach
2010-07-15 11:51 Baruch Siach
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.