diff options
author | Jeff Layton <jlayton@redhat.com> | 2012-10-10 16:43:21 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-10-12 20:15:10 -0400 |
commit | f81700bd831efcd12eb7f0e66b24b16c2ad00a32 (patch) | |
tree | 9763e5c46e31d2500b1ba9186b882622739c9295 /fs/proc/base.c | |
parent | 7950e3852ab86826b7349a535d2e8b0000340d7f (diff) |
procfs: don't need a PATH_MAX allocation to hold a string representation of an int
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/proc/base.c')
-rw-r--r-- | fs/proc/base.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/proc/base.c b/fs/proc/base.c index ef5c84be66f9..144a96732dd7 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c | |||
@@ -2258,7 +2258,8 @@ static void *proc_self_follow_link(struct dentry *dentry, struct nameidata *nd) | |||
2258 | pid_t tgid = task_tgid_nr_ns(current, ns); | 2258 | pid_t tgid = task_tgid_nr_ns(current, ns); |
2259 | char *name = ERR_PTR(-ENOENT); | 2259 | char *name = ERR_PTR(-ENOENT); |
2260 | if (tgid) { | 2260 | if (tgid) { |
2261 | name = __getname(); | 2261 | /* 11 for max length of signed int in decimal + NULL term */ |
2262 | name = kmalloc(12, GFP_KERNEL); | ||
2262 | if (!name) | 2263 | if (!name) |
2263 | name = ERR_PTR(-ENOMEM); | 2264 | name = ERR_PTR(-ENOMEM); |
2264 | else | 2265 | else |
@@ -2273,7 +2274,7 @@ static void proc_self_put_link(struct dentry *dentry, struct nameidata *nd, | |||
2273 | { | 2274 | { |
2274 | char *s = nd_get_link(nd); | 2275 | char *s = nd_get_link(nd); |
2275 | if (!IS_ERR(s)) | 2276 | if (!IS_ERR(s)) |
2276 | __putname(s); | 2277 | kfree(s); |
2277 | } | 2278 | } |
2278 | 2279 | ||
2279 | static const struct inode_operations proc_self_inode_operations = { | 2280 | static const struct inode_operations proc_self_inode_operations = { |