aboutsummaryrefslogtreecommitdiffstats
path: root/fs/proc/generic.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/proc/generic.c')
-rw-r--r--fs/proc/generic.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/fs/proc/generic.c b/fs/proc/generic.c
index b3647fe6a608..0d80cef4cfb9 100644
--- a/fs/proc/generic.c
+++ b/fs/proc/generic.c
@@ -427,7 +427,7 @@ struct dentry *proc_lookup_de(struct proc_dir_entry *de, struct inode *dir,
427 if (!memcmp(dentry->d_name.name, de->name, de->namelen)) { 427 if (!memcmp(dentry->d_name.name, de->name, de->namelen)) {
428 pde_get(de); 428 pde_get(de);
429 spin_unlock(&proc_subdir_lock); 429 spin_unlock(&proc_subdir_lock);
430 error = -EINVAL; 430 error = -ENOMEM;
431 inode = proc_get_inode(dir->i_sb, de); 431 inode = proc_get_inode(dir->i_sb, de);
432 goto out_unlock; 432 goto out_unlock;
433 } 433 }
@@ -605,7 +605,8 @@ static struct proc_dir_entry *__proc_create(struct proc_dir_entry **parent,
605 unsigned int len; 605 unsigned int len;
606 606
607 /* make sure name is valid */ 607 /* make sure name is valid */
608 if (!name || !strlen(name)) goto out; 608 if (!name || !strlen(name))
609 goto out;
609 610
610 if (xlate_proc_name(name, parent, &fn) != 0) 611 if (xlate_proc_name(name, parent, &fn) != 0)
611 goto out; 612 goto out;
@@ -616,20 +617,18 @@ static struct proc_dir_entry *__proc_create(struct proc_dir_entry **parent,
616 617
617 len = strlen(fn); 618 len = strlen(fn);
618 619
619 ent = kmalloc(sizeof(struct proc_dir_entry) + len + 1, GFP_KERNEL); 620 ent = kzalloc(sizeof(struct proc_dir_entry) + len + 1, GFP_KERNEL);
620 if (!ent) goto out; 621 if (!ent)
622 goto out;
621 623
622 memset(ent, 0, sizeof(struct proc_dir_entry));
623 memcpy(ent->name, fn, len + 1); 624 memcpy(ent->name, fn, len + 1);
624 ent->namelen = len; 625 ent->namelen = len;
625 ent->mode = mode; 626 ent->mode = mode;
626 ent->nlink = nlink; 627 ent->nlink = nlink;
627 atomic_set(&ent->count, 1); 628 atomic_set(&ent->count, 1);
628 ent->pde_users = 0;
629 spin_lock_init(&ent->pde_unload_lock); 629 spin_lock_init(&ent->pde_unload_lock);
630 ent->pde_unload_completion = NULL;
631 INIT_LIST_HEAD(&ent->pde_openers); 630 INIT_LIST_HEAD(&ent->pde_openers);
632 out: 631out:
633 return ent; 632 return ent;
634} 633}
635 634