procfs: don't need a PATH_MAX allocation to hold a string representation of an int
authorJeff Layton <jlayton@redhat.com>
Wed, 10 Oct 2012 20:43:21 +0000 (16:43 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Sat, 13 Oct 2012 00:15:10 +0000 (20:15 -0400)
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/proc/base.c

index ef5c84b..144a967 100644 (file)
@@ -2258,7 +2258,8 @@ static void *proc_self_follow_link(struct dentry *dentry, struct nameidata *nd)
        pid_t tgid = task_tgid_nr_ns(current, ns);
        char *name = ERR_PTR(-ENOENT);
        if (tgid) {
-               name = __getname();
+               /* 11 for max length of signed int in decimal + NULL term */
+               name = kmalloc(12, GFP_KERNEL);
                if (!name)
                        name = ERR_PTR(-ENOMEM);
                else
@@ -2273,7 +2274,7 @@ static void proc_self_put_link(struct dentry *dentry, struct nameidata *nd,
 {
        char *s = nd_get_link(nd);
        if (!IS_ERR(s))
-               __putname(s);
+               kfree(s);
 }
 
 static const struct inode_operations proc_self_inode_operations = {