linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] procfs: don't need a PATH_MAX allocation to hold a string representation of an int
@ 2012-09-07 12:34 Jeff Layton
  2012-09-07 12:48 ` Jeff Layton
  2012-09-07 17:27 ` [PATCH v2] " Jeff Layton
  0 siblings, 2 replies; 7+ messages in thread
From: Jeff Layton @ 2012-09-07 12:34 UTC (permalink / raw)
  To: viro; +Cc: linux-fsdevel, linux-kernel

Signed-off-by: Jeff Layton <jlayton@redhat.com>
---
 fs/proc/base.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/fs/proc/base.c b/fs/proc/base.c
index 1b6c84c..58e801b 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -2758,7 +2758,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();
+		/* 10 for max length of an int in decimal + NULL terminator */
+		name = kmalloc(11, GFP_KERNEL);
 		if (!name)
 			name = ERR_PTR(-ENOMEM);
 		else
@@ -2773,7 +2774,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 = {
-- 
1.7.11.4


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-09-10 14:28 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-07 12:34 [PATCH] procfs: don't need a PATH_MAX allocation to hold a string representation of an int Jeff Layton
2012-09-07 12:48 ` Jeff Layton
2012-09-07 12:58   ` Pádraig Brady
2012-09-07 19:44     ` J. Bruce Fields
2012-09-10 13:23       ` Jeff Layton
2012-09-10 14:28         ` J. Bruce Fields
2012-09-07 17:27 ` [PATCH v2] " Jeff Layton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).