From 9789d8e0cfc6b5e265d9b0aa6e86b394a6d216a1 Mon Sep 17 00:00:00 2001 From: Wang Long Date: Wed, 9 Sep 2015 15:37:19 -0700 Subject: lib/test_kasan.c: fix a typo Signed-off-by: Wang Long Cc: Andrey Ryabinin Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- lib/test_kasan.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/test_kasan.c') diff --git a/lib/test_kasan.c b/lib/test_kasan.c index 098c08eddfab..044c54dd43fd 100644 --- a/lib/test_kasan.c +++ b/lib/test_kasan.c @@ -65,7 +65,7 @@ static noinline void __init kmalloc_node_oob_right(void) kfree(ptr); } -static noinline void __init kmalloc_large_oob_rigth(void) +static noinline void __init kmalloc_large_oob_right(void) { char *ptr; size_t size = KMALLOC_MAX_CACHE_SIZE + 10; @@ -259,7 +259,7 @@ static int __init kmalloc_tests_init(void) kmalloc_oob_right(); kmalloc_oob_left(); kmalloc_node_oob_right(); - kmalloc_large_oob_rigth(); + kmalloc_large_oob_right(); kmalloc_oob_krealloc_more(); kmalloc_oob_krealloc_less(); kmalloc_oob_16(); -- cgit v1.2.3 From 6b4a35fc19a9229080dead8a9c316e8857b3e94d Mon Sep 17 00:00:00 2001 From: Wang Long Date: Wed, 9 Sep 2015 15:37:22 -0700 Subject: lib/test_kasan.c: make kmalloc_oob_krealloc_less more correctly In kmalloc_oob_krealloc_less, I think it is better to test the size2 boundary. If we do not call krealloc, the access of position size1 will still cause out-of-bounds and access of position size2 does not. After call krealloc, the access of position size2 cause out-of-bounds. So using size2 is more correct. Signed-off-by: Wang Long Cc: Andrey Ryabinin Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- lib/test_kasan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/test_kasan.c') diff --git a/lib/test_kasan.c b/lib/test_kasan.c index 044c54dd43fd..c1efb1b61017 100644 --- a/lib/test_kasan.c +++ b/lib/test_kasan.c @@ -114,7 +114,7 @@ static noinline void __init kmalloc_oob_krealloc_less(void) kfree(ptr1); return; } - ptr2[size1] = 'x'; + ptr2[size2] = 'x'; kfree(ptr2); } -- cgit v1.2.3