All of lore.kernel.org
 help / color / mirror / Atom feed
* [KJ] [Patch] kzalloc() conversion in  lib/
@ 2006-03-05  8:41 Eric Sesterhenn
  2006-03-05 17:58 ` Alexey Dobriyan
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Eric Sesterhenn @ 2006-03-05  8:41 UTC (permalink / raw)
  To: kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 1583 bytes --]

hi, 

this patch converts lib/ to kzalloc usage.
Compile tested with allyesconfig.

Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>

--- linux-2.6.16-rc5-mm1/lib/genalloc.c.orig	2006-03-04 21:55:53.000000000 +0100
+++ linux-2.6.16-rc5-mm1/lib/genalloc.c	2006-03-04 21:57:03.000000000 +0100
@@ -47,20 +47,17 @@ struct gen_pool *gen_pool_create(int nr_
 	if (!max_chunk_shift)
 		max_chunk_shift = PAGE_SHIFT;
 
-	poolp = kmalloc(sizeof(struct gen_pool), GFP_KERNEL);
+	poolp = kzalloc(sizeof(struct gen_pool), GFP_KERNEL);
 	if (!poolp)
 		return NULL;
-	memset(poolp, 0, sizeof(struct gen_pool));
-	poolp->h = kmalloc(sizeof(struct gen_pool_link) *
-			   (max_chunk_shift - ALLOC_MIN_SHIFT + 1),
-			   GFP_KERNEL);
+	poolp->h = kcalloc((max_chunk_shift - ALLOC_MIN_SHIFT + ),
+				sizeof(struct gen_pool_link), 
+				GFP_KERNEL);
 	if (!poolp->h) {
 		printk(KERN_WARNING "gen_pool_alloc() failed to allocate\n");
 		kfree(poolp);
 		return NULL;
 	}
-	memset(poolp->h, 0, sizeof(struct gen_pool_link) *
-	       (max_chunk_shift - ALLOC_MIN_SHIFT + 1));
 
 	spin_lock_init(&poolp->lock);
 	poolp->get_new_chunk = fp;
--- linux-2.6.16-rc5-mm1/lib/kobject.c.orig	2006-03-04 21:57:14.000000000 +0100
+++ linux-2.6.16-rc5-mm1/lib/kobject.c	2006-03-04 21:57:23.000000000 +0100
@@ -111,10 +111,9 @@ char *kobject_get_path(struct kobject *k
 	len = get_kobj_path_length(kobj);
 	if (len == 0)
 		return NULL;
-	path = kmalloc(len, gfp_mask);
+	path = kzalloc(len, gfp_mask);
 	if (!path)
 		return NULL;
-	memset(path, 0x00, len);
 	fill_kobj_path(kobj, path, len);
 
 	return path;



[-- Attachment #2: Type: text/plain, Size: 168 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors

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

end of thread, other threads:[~2006-03-05 21:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-05  8:41 [KJ] [Patch] kzalloc() conversion in lib/ Eric Sesterhenn
2006-03-05 17:58 ` Alexey Dobriyan
2006-03-05 20:43 ` Jaco Kroon
2006-03-05 20:50 ` Eric Sesterhenn
2006-03-05 20:55 ` Eric Sesterhenn
2006-03-05 21:09 ` Jaco Kroon

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.