[Stgt-devel] [PATCH] Fix list_length_is_one()

Arne Redlich agr
Wed Jun 18 20:18:27 CEST 2008


list_length_is_one(list) erroneously also returns true if list_empty(list).
---
 usr/iscsi/isns.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/usr/iscsi/isns.c b/usr/iscsi/isns.c
index d713a2f..8c8fe3f 100644
--- a/usr/iscsi/isns.c
+++ b/usr/iscsi/isns.c
@@ -379,7 +379,7 @@ static int isns_deregister(void)
 
 static inline int list_length_is_one(const struct list_head *head)
 {
-        return head->next == head->prev;
+        return (!list_empty(head) && head->next == head->prev);
 }
 
 int isns_target_register(char *name)
-- 
1.5.4.3




More information about the stgt mailing list