Commit 0a08739e authored by Jesper Juhl's avatar Jesper Juhl Committed by Catalin Marinas

kmemleak: remove memset by using kzalloc

We don't need to memset if we just use kzalloc() rather than kmalloc() in
Signed-off-by: default avatarJesper Juhl <>
Reviewed-by: default avatarMinchan Kim <>
Signed-off-by: default avatarCatalin Marinas <>
parent 3c0eee3f
......@@ -75,13 +75,11 @@ static int __init kmemleak_test_init(void)
* after the module is removed.
for (i = 0; i < 10; i++) {
elem = kmalloc(sizeof(*elem), GFP_KERNEL);
pr_info("kmemleak: kmalloc(sizeof(*elem)) = %p\n", elem);
elem = kzalloc(sizeof(*elem), GFP_KERNEL);
pr_info("kmemleak: kzalloc(sizeof(*elem)) = %p\n", elem);
if (!elem)
return -ENOMEM;
memset(elem, 0, sizeof(*elem));
list_add_tail(&elem->list, &test_list);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment