提交 0a08739e 编写于 作者: J Jesper Juhl 提交者: Catalin Marinas

kmemleak: remove memset by using kzalloc

We don't need to memset if we just use kzalloc() rather than kmalloc() in
kmemleak_test_init().
Signed-off-by: NJesper Juhl <jj@chaosbits.net>
Reviewed-by: NMinchan Kim <minchan.kim@gmail.com>
Signed-off-by: NCatalin Marinas <catalin.marinas@arm.com>
上级 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));
INIT_LIST_HEAD(&elem->list);
list_add_tail(&elem->list, &test_list);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册