diff options
author | Rasmus Villemoes <linux@rasmusvillemoes.dk> | 2014-08-07 01:09:40 +0200 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-08-07 03:01:25 +0200 |
commit | 9d418dcc6d15539a9567b2ad7fe7473648989f44 (patch) | |
tree | 60e5064e246f254a65e0c2e979c4d0bf353fd00a /lib | |
parent | lib: list_sort_test(): return -ENOMEM when allocation fails (diff) | |
download | linux-9d418dcc6d15539a9567b2ad7fe7473648989f44.tar.xz linux-9d418dcc6d15539a9567b2ad7fe7473648989f44.zip |
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 <linux@rasmusvillemoes.dk>
Cc: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Cc: Don Mullis <don.mullis@gmail.com>
Cc: Dave Chinner <david@fromorbit.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/list_sort.c | 5 |
1 files changed, 5 insertions, 0 deletions
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", |