All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kmemleak: remove memset by using kzalloc
@ 2010-10-30 21:43 ` Jesper Juhl
  0 siblings, 0 replies; 4+ messages in thread
From: Jesper Juhl @ 2010-10-30 21:43 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-mm, Catalin Marinas

We don't need to memset if we just use kzalloc() rather than kmalloc() in 
kmemleak_test_init().

(please CC on replies)


Signed-off-by: Jesper Juhl <jj@chaosbits.net>
---
 kmemleak-test.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/mm/kmemleak-test.c b/mm/kmemleak-test.c
index 177a516..ff0d977 100644
--- a/mm/kmemleak-test.c
+++ b/mm/kmemleak-test.c
@@ -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);
 	}
 


-- 
Jesper Juhl <jj@chaosbits.net>             http://www.chaosbits.net/
Plain text mails only, please      http://www.expita.com/nomime.html
Don't top-post  http://www.catb.org/~esr/jargon/html/T/top-post.html


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] kmemleak: remove memset by using kzalloc
@ 2010-10-30 21:43 ` Jesper Juhl
  0 siblings, 0 replies; 4+ messages in thread
From: Jesper Juhl @ 2010-10-30 21:43 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-mm, Catalin Marinas

We don't need to memset if we just use kzalloc() rather than kmalloc() in 
kmemleak_test_init().

(please CC on replies)


Signed-off-by: Jesper Juhl <jj@chaosbits.net>
---
 kmemleak-test.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/mm/kmemleak-test.c b/mm/kmemleak-test.c
index 177a516..ff0d977 100644
--- a/mm/kmemleak-test.c
+++ b/mm/kmemleak-test.c
@@ -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);
 	}
 


-- 
Jesper Juhl <jj@chaosbits.net>             http://www.chaosbits.net/
Plain text mails only, please      http://www.expita.com/nomime.html
Don't top-post  http://www.catb.org/~esr/jargon/html/T/top-post.html

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] kmemleak: remove memset by using kzalloc
  2010-10-30 21:43 ` Jesper Juhl
@ 2010-10-30 23:28   ` Minchan Kim
  -1 siblings, 0 replies; 4+ messages in thread
From: Minchan Kim @ 2010-10-30 23:28 UTC (permalink / raw)
  To: Jesper Juhl; +Cc: linux-kernel, linux-mm, Catalin Marinas

On Sun, Oct 31, 2010 at 6:43 AM, Jesper Juhl <jj@chaosbits.net> wrote:
> We don't need to memset if we just use kzalloc() rather than kmalloc() in
> kmemleak_test_init().
>
> (please CC on replies)
>
>
> Signed-off-by: Jesper Juhl <jj@chaosbits.net>
Reviewed-by: Minchan Kim <minchan.kim@gmail.com>



-- 
Kind regards,
Minchan Kim

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] kmemleak: remove memset by using kzalloc
@ 2010-10-30 23:28   ` Minchan Kim
  0 siblings, 0 replies; 4+ messages in thread
From: Minchan Kim @ 2010-10-30 23:28 UTC (permalink / raw)
  To: Jesper Juhl; +Cc: linux-kernel, linux-mm, Catalin Marinas

On Sun, Oct 31, 2010 at 6:43 AM, Jesper Juhl <jj@chaosbits.net> wrote:
> We don't need to memset if we just use kzalloc() rather than kmalloc() in
> kmemleak_test_init().
>
> (please CC on replies)
>
>
> Signed-off-by: Jesper Juhl <jj@chaosbits.net>
Reviewed-by: Minchan Kim <minchan.kim@gmail.com>



-- 
Kind regards,
Minchan Kim

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-10-30 23:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-30 21:43 [PATCH] kmemleak: remove memset by using kzalloc Jesper Juhl
2010-10-30 21:43 ` Jesper Juhl
2010-10-30 23:28 ` Minchan Kim
2010-10-30 23:28   ` Minchan Kim

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.