From: yan <clouds.yan@gmail.com>
To: akpm@linux-foundation.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 3/3 v2] proc: use kzalloc instead of kmalloc and memset
Date: Wed, 5 Sep 2012 20:17:17 +0800 [thread overview]
Message-ID: <1346847437-3308-4-git-send-email-clouds.yan@gmail.com> (raw)
In-Reply-To: <1346847437-3308-1-git-send-email-clouds.yan@gmail.com>
Part of the memory will be written twice after this change, but that
should be negligible.
Signed-off-by: yan <clouds.yan@gmail.com>
---
fs/proc/generic.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/fs/proc/generic.c b/fs/proc/generic.c
index 9e8f631..38de015 100644
--- a/fs/proc/generic.c
+++ b/fs/proc/generic.c
@@ -616,10 +616,9 @@ static struct proc_dir_entry *__proc_create(struct proc_dir_entry **parent,
len = strlen(fn);
- ent = kmalloc(sizeof(struct proc_dir_entry) + len + 1, GFP_KERNEL);
+ ent = kzalloc(sizeof(struct proc_dir_entry) + len + 1, GFP_KERNEL);
if (!ent) goto out;
- memset(ent, 0, sizeof(struct proc_dir_entry));
memcpy(ent->name, fn, len + 1);
ent->namelen = len;
ent->mode = mode;
--
1.7.9.5
next prev parent reply other threads:[~2012-09-05 12:17 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-05 12:17 [PATCH 0/3 v2] Trivial code clean for procfs yan
2012-09-05 12:17 ` [PATCH 1/3 v2] proc: return -ENOMEM when inode allocation failed yan
2012-09-05 12:17 ` [PATCH 2/3 v2] proc : no need to initialize proc_inode->fd in proc_get_inode yan
2012-09-05 12:17 ` yan [this message]
2012-09-05 21:37 ` [PATCH 3/3 v2] proc: use kzalloc instead of kmalloc and memset Andrew Morton
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=1346847437-3308-4-git-send-email-clouds.yan@gmail.com \
--to=clouds.yan@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox