Skip to content

Commit 0a08739

Browse files
jjuhlctmarinas
authored andcommitted
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: Jesper Juhl <jj@chaosbits.net> Reviewed-by: Minchan Kim <minchan.kim@gmail.com> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
1 parent 3c0eee3 commit 0a08739

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

mm/kmemleak-test.c

+2-4
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,11 @@ static int __init kmemleak_test_init(void)
7575
* after the module is removed.
7676
*/
7777
for (i = 0; i < 10; i++) {
78-
elem = kmalloc(sizeof(*elem), GFP_KERNEL);
79-
pr_info("kmemleak: kmalloc(sizeof(*elem)) = %p\n", elem);
78+
elem = kzalloc(sizeof(*elem), GFP_KERNEL);
79+
pr_info("kmemleak: kzalloc(sizeof(*elem)) = %p\n", elem);
8080
if (!elem)
8181
return -ENOMEM;
82-
memset(elem, 0, sizeof(*elem));
8382
INIT_LIST_HEAD(&elem->list);
84-
8583
list_add_tail(&elem->list, &test_list);
8684
}
8785

0 commit comments

Comments
 (0)