* [RFC PATCH] test_kasan: make kmalloc_oob_krealloc_less more correctly
@ 2015-08-21 8:56 Wang Long
0 siblings, 0 replies; only message in thread
From: Wang Long @ 2015-08-21 8:56 UTC (permalink / raw)
To: a.ryabinin, ryabinin.a.a
Cc: akpm, adech.fo, linux-kernel, wanglong, peifeiyue, long.wanglong
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, use size2 is more correctly.
Signed-off-by: Wang Long <long.wanglong@huawei.com>
---
lib/test_kasan.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/test_kasan.c b/lib/test_kasan.c
index 044c54d..c1efb1b 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);
}
--
1.8.3.4
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2015-08-21 8:57 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-21 8:56 [RFC PATCH] test_kasan: make kmalloc_oob_krealloc_less more correctly Wang Long
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®