From 9d418dcc6d15539a9567b2ad7fe7473648989f44 Mon Sep 17 00:00:00 2001 From: Rasmus Villemoes Date: Wed, 6 Aug 2014 16:09:40 -0700 Subject: [PATCH] lib: list_sort_test(): add extra corruption check Add a check to make sure that the prev pointer of the list head points to the last element on the list. Signed-off-by: Rasmus Villemoes Cc: Artem Bityutskiy Cc: Don Mullis Cc: Dave Chinner Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- lib/list_sort.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/list_sort.c b/lib/list_sort.c index 291412ade89a..fbdbc867b252 100644 --- a/lib/list_sort.c +++ b/lib/list_sort.c @@ -272,6 +272,11 @@ static int __init list_sort_test(void) } count++; } + if (head.prev != cur) { + printk(KERN_ERR "list_sort_test: error: list is corrupted\n"); + goto exit; + } + if (count != TEST_LIST_LEN) { printk(KERN_ERR "list_sort_test: error: bad list length %d", -- 2.20.1