Commit f81700bd authored by Jeff Layton's avatar Jeff Layton Committed by Al Viro

procfs: don't need a PATH_MAX allocation to hold a string representation of an int

Signed-off-by: default avatarJeff Layton <jlayton@redhat.com>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 7950e385
...@@ -2258,7 +2258,8 @@ static void *proc_self_follow_link(struct dentry *dentry, struct nameidata *nd) ...@@ -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); pid_t tgid = task_tgid_nr_ns(current, ns);
char *name = ERR_PTR(-ENOENT); char *name = ERR_PTR(-ENOENT);
if (tgid) { if (tgid) {
name = __getname(); /* 11 for max length of signed int in decimal + NULL term */
name = kmalloc(12, GFP_KERNEL);
if (!name) if (!name)
name = ERR_PTR(-ENOMEM); name = ERR_PTR(-ENOMEM);
else else
...@@ -2273,7 +2274,7 @@ static void proc_self_put_link(struct dentry *dentry, struct nameidata *nd, ...@@ -2273,7 +2274,7 @@ static void proc_self_put_link(struct dentry *dentry, struct nameidata *nd,
{ {
char *s = nd_get_link(nd); char *s = nd_get_link(nd);
if (!IS_ERR(s)) if (!IS_ERR(s))
__putname(s); kfree(s);
} }
static const struct inode_operations proc_self_inode_operations = { static const struct inode_operations proc_self_inode_operations = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment