]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
proc: use kzalloc instead of kmalloc and memset
authoryan <clouds.yan@gmail.com>
Thu, 13 Sep 2012 01:01:29 +0000 (11:01 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Thu, 13 Sep 2012 07:28:18 +0000 (17:28 +1000)
Part of the memory will be written twice after this change, but that
should be negligible.

Signed-off-by: yan <clouds.yan@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
fs/proc/generic.c

index 9e8f631643094a4e82c410c3d1ae5194b2dbe8e5..38de015c0690dc9d038c7fa02195c8af534d2f67 100644 (file)
@@ -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;