From: "Pádraig Brady" <P@draigBrady.com>
To: Jeff Layton <jlayton@poochiereds.net>
Cc: viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] procfs: don't need a PATH_MAX allocation to hold a string representation of an int
Date: Fri, 07 Sep 2012 13:58:03 +0100 [thread overview]
Message-ID: <5049EF5B.3020607@draigBrady.com> (raw)
In-Reply-To: <20120907084814.07a59c98@corrin.poochiereds.net>
On 09/07/2012 01:48 PM, Jeff Layton wrote:
> On Fri, 7 Sep 2012 08:34:53 -0400
> Jeff Layton<jlayton@redhat.com> wrote:
>
>> 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);
>
> ^^^^^
> Bah...my mistake. This should be "12", since it's possible (though
> unlikely) that this value could be negative. Is there a better way to
> express "strlen of max representation of an int in decimal" ?
See INT_BUFSIZE_BOUND() in:
http://git.sv.gnu.org/gitweb/?p=gnulib.git;a=blob;f=lib/intprops.h;hb=HEAD
cheers,
Pádraig.
next prev parent reply other threads:[~2012-09-07 12:58 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-07 12:34 Jeff Layton
2012-09-07 12:48 ` Jeff Layton
2012-09-07 12:58 ` Pádraig Brady [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5049EF5B.3020607@draigBrady.com \
--to=p@draigbrady.com \
--cc=jlayton@poochiereds.net \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®