summaryrefslogtreecommitdiff
path: root/lib/test_kasan.c
diff options
context:
space:
mode:
authorWang Long <long.wanglong@huawei.com>2015-09-10 01:37:22 +0300
committerLinus Torvalds <torvalds@linux-foundation.org>2015-09-10 23:29:01 +0300
commit6b4a35fc19a9229080dead8a9c316e8857b3e94d (patch)
tree977fffd2756175eb42271dc10585a453745fffe0 /lib/test_kasan.c
parent9789d8e0cfc6b5e265d9b0aa6e86b394a6d216a1 (diff)
downloadlinux-6b4a35fc19a9229080dead8a9c316e8857b3e94d.tar.xz
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 <long.wanglong@huawei.com> Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'lib/test_kasan.c')
-rw-r--r--lib/test_kasan.c2
1 files changed, 1 insertions, 1 deletions
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);
}