From: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
To: "David S. Ahern" <daahern@cisco.com>
Cc: linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] perf tools: Add symfs option for off-box analysis using specified tree
Date: Wed, 8 Dec 2010 22:29:42 -0200 [thread overview]
Message-ID: <20101209002942.GA11252@ghostprotocols.net> (raw)
In-Reply-To: <4D00052D.1020206@cisco.com>
Em Wed, Dec 08, 2010 at 03:22:37PM -0700, David S. Ahern escreveu:
> On 12/08/10 13:56, Arnaldo Carvalho de Melo wrote:
> > Em Tue, Dec 07, 2010 at 07:42:54PM -0700, David Ahern escreveu:
> >> + if ((strlen(symbol_conf.symfs) != 0) ||
> >
> > I suggest you use:
> >
> > if (symbol_conf.symfs[1] ||
> >
> > cheaper :)
>
> Changed. I presume you meant: symbol_conf.symfs[0] -- ie., element 0
> has something other than '\0' which means strlen > 0
Right, off-by-one mistake by me, sorry
> >> @@ -1778,17 +1786,20 @@ static int dso__load_vmlinux(struct dso *self, struct map *map,
> >> const char *vmlinux, symbol_filter_t filter)
> >> {
> >> int err = -1, fd;
> >> + char symfs_vmlinux[PATH_MAX];
> >> - fd = open(vmlinux, O_RDONLY);
> >> + snprintf(symfs_vmlinux, sizeof(symfs_vmlinux), "%s/%s",
> >> + symbol_conf.symfs, vmlinux);
> >
> > Its userspace, so stack is plenty, but I guess if using asprintf
> > wouldn't be better...
> >
> > I.e. if we were programming some kernel module, creating a 4K stack
> > variable would be considered bad practice, so I think it is here as
> > well.
>
> Declaring symfs_vmlinux on the stack is consistent with other PATH_MAX
> declarations within perf, and especially within util/symbol.c.
Ok, so keep it like that and I'll then work on a follow on patch to
remove these stack abuses.
> >> + if (strlen(symbol_conf.symfs) == 0) {
> >
> > Do it as:
> >
> > if (!symbol_conf.symfs[1])
> > return 0;
> >
> > And then the patch can be made smaller.
>
> Done.
>
>
> I also added the symfs option to the Documentation files. Will send an
> updated patch.
Thanks a lot!
- Arnaldo
next prev parent reply other threads:[~2010-12-09 0:29 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-08 2:42 [PATCH] perf tools: Add symfs option for off-box analysis using specified tree David Ahern
2010-12-08 20:56 ` Arnaldo Carvalho de Melo
2010-12-08 22:22 ` David S. Ahern
2010-12-09 0:29 ` Arnaldo Carvalho de Melo [this message]
-- strict thread matches above, loose matches on Subject: below --
2010-11-29 16:58 David Ahern
2010-11-22 14:45 David Ahern
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=20101209002942.GA11252@ghostprotocols.net \
--to=acme@ghostprotocols.net \
--cc=daahern@cisco.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.