From: Eric Sesterhenn <snakebyte@gmx.de>
To: kernel-janitors@vger.kernel.org
Subject: [KJ] [Patch] kzalloc() conversion in lib/
Date: Sun, 05 Mar 2006 08:41:37 +0000 [thread overview]
Message-ID: <1141548097.6426.9.camel@alice> (raw)
[-- 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
next reply other threads:[~2006-03-05 8:41 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-05 8:41 Eric Sesterhenn [this message]
2006-03-05 17:58 ` [KJ] [Patch] kzalloc() conversion in lib/ 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1141548097.6426.9.camel@alice \
--to=snakebyte@gmx.de \
--cc=kernel-janitors@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.