Skip to content

Commit

Permalink
kmemleak: remove memset by using kzalloc
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
jjuhl authored and ctmarinas committed Jan 27, 2011
1 parent 3c0eee3 commit 0a08739
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions mm/kmemleak-test.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -75,13 +75,11 @@ static int __init kmemleak_test_init(void)
* after the module is removed. * after the module is removed.
*/ */
for (i = 0; i < 10; i++) { for (i = 0; i < 10; i++) {
elem = kmalloc(sizeof(*elem), GFP_KERNEL); elem = kzalloc(sizeof(*elem), GFP_KERNEL);
pr_info("kmemleak: kmalloc(sizeof(*elem)) = %p\n", elem); pr_info("kmemleak: kzalloc(sizeof(*elem)) = %p\n", elem);
if (!elem) if (!elem)
return -ENOMEM; return -ENOMEM;
memset(elem, 0, sizeof(*elem));
INIT_LIST_HEAD(&elem->list); INIT_LIST_HEAD(&elem->list);

list_add_tail(&elem->list, &test_list); list_add_tail(&elem->list, &test_list);
} }


Expand Down

0 comments on commit 0a08739

Please sign in to comment.