From: Rasmus Villemoes Date: Wed, 6 Aug 2014 23:09:40 +0000 (-0700) Subject: lib: list_sort_test(): add extra corruption check X-Git-Tag: v4.9.8~5947^2~52 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9d418dcc6d15539a9567b2ad7fe7473648989f44;p=platform%2Fkernel%2Flinux-rpi3.git 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 --- diff --git a/lib/list_sort.c b/lib/list_sort.c index 291412a..fbdbc86 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",