[PATCH] Make sure the ->next/prev pointers in the list head

Ronnie Sahlberg ronniesahlberg
Mon Jul 7 03:06:11 CEST 2008


are non-NULL
 before we dereference them.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg at gmail.com>
---
 usr/list.h |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/usr/list.h b/usr/list.h
index 4d76057..39222ab 100644
--- a/usr/list.h
+++ b/usr/list.h
@@ -82,6 +82,9 @@ static inline void __list_del(struct list_head *
prev, struct list_head * next)

 static inline void list_del(struct list_head *entry)
 {
+	if ((entry->prev == NULL) && (entry->next == NULL)) {
+		return;
+	}
 	__list_del(entry->prev, entry->next);
 	entry->next = entry->prev = NULL;
 }
-- 
1.5.4.3



More information about the stgt mailing list