Yi Wang
unread,Feb 12, 2020, 4:54:26 AM2/12/20Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to arya...@virtuozzo.com, gli...@google.com, dvy...@google.com, kasa...@googlegroups.com, linux-...@vger.kernel.org, xue.z...@zte.com.cn, wang...@zte.com.cn, wang.l...@zte.com.cn, Huang Zijiang
From: Huang Zijiang <
huang....@zte.com.cn>
Use kzalloc instead of manually setting kmalloc
with flag GFP_ZERO since kzalloc sets allocated memory
to zero.
Change in v2:
add indation
Signed-off-by: Huang Zijiang <
huang....@zte.com.cn>
Signed-off-by: Yi Wang <
wang...@zte.com.cn>
---
lib/test_kasan.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/test_kasan.c b/lib/test_kasan.c
index 328d33b..79be158 100644
--- a/lib/test_kasan.c
+++ b/lib/test_kasan.c
@@ -599,7 +599,7 @@ static noinline void __init kasan_memchr(void)
size_t size = 24;
pr_info("out-of-bounds in memchr\n");
- ptr = kmalloc(size, GFP_KERNEL | __GFP_ZERO);
+ ptr = kzalloc(size, GFP_KERNEL);
if (!ptr)
return;
@@ -614,7 +614,7 @@ static noinline void __init kasan_memcmp(void)
int arr[9];
pr_info("out-of-bounds in memcmp\n");
- ptr = kmalloc(size, GFP_KERNEL | __GFP_ZERO);
+ ptr = kzalloc(size, GFP_KERNEL);
if (!ptr)
return;
@@ -629,7 +629,7 @@ static noinline void __init kasan_strings(void)
size_t size = 24;
pr_info("use-after-free in strchr\n");
- ptr = kmalloc(size, GFP_KERNEL | __GFP_ZERO);
+ ptr = kzalloc(size, GFP_KERNEL);
if (!ptr)
return;
--
1.9.1