From: Wang Nan <wangnan0@huawei.com>
To: Namhyung Kim <namhyung@kernel.org>
Cc: <acme@kernel.org>, <jolsa@kernel.org>,
<linux-kernel@vger.kernel.org>, <mingo@redhat.com>,
<lizefan@huawei.com>, <pi3orama@163.com>
Subject: Re: [PATCH] perf: fix a segfault problem.
Date: Fri, 13 Mar 2015 18:07:34 +0800 [thread overview]
Message-ID: <5502B6E6.2050204@huawei.com> (raw)
In-Reply-To: <20150313094615.GC10836@danjae.skbroadband>
On 2015/3/13 17:46, Namhyung Kim wrote:
> On Fri, Mar 13, 2015 at 08:41:32AM +0000, Wang Nan wrote:
>> Without this patch, perf report cause segfault if pass "" as '-t':
>>
>> $ perf report -t ""
>>
>> # To display the perf.data header info, please use --header/--header-only options.
>> #
>> # Samples: 37 of event 'syscalls:sys_enter_write'
>> # Event count (approx.): 37
>> #
>> # Children SelfCommand Shared Object Symbol
>> Segmentation fault
>>
>> This patch avoid the segfault by checking empty string for
>> 'symbol_conf.field_sep'.
>
> What about resetting it to NULL if empty string was given?
>
In fact I'm not very clear why we need such 'symbol_conf.field_sep', so I'm
not sure whether '-t ""' is totally meanless or not.
-t option replaces a group of character with '.' and appends them after a field.
With -t 'abc' I get something like:
#
# OverheadabcCommand abcShared Object abcSymbol
100.00%abcb.beltr.ceabc[kernel.k.llsyms]abc[k] 0xffffffff810118f0
...
Hard to read...
I read docs and your commit messages, but still not understand the option. Could you
please explain the goal and usage of that option again?
Thank you.
> Thanks,
> Namhyung
>
>
>>
>> Signed-off-by: Wang Nan <wangnan0@huawei.com>
>> ---
>> tools/perf/util/sort.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
>> index 4593f36..7f563a0 100644
>> --- a/tools/perf/util/sort.c
>> +++ b/tools/perf/util/sort.c
>> @@ -31,7 +31,8 @@ static int repsep_snprintf(char *bf, size_t size, const char *fmt, ...)
>>
>> va_start(ap, fmt);
>> n = vsnprintf(bf, size, fmt, ap);
>> - if (symbol_conf.field_sep && n > 0) {
>> + if (symbol_conf.field_sep && n > 0 &&
>> + (symbol_conf.field_sep[0] != '\0')) {
>> char *sep = bf;
>>
>> while (1) {
>> --
>> 1.8.3.4
>>
next prev parent reply other threads:[~2015-03-13 10:08 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-13 8:41 Wang Nan
2015-03-13 9:46 ` Namhyung Kim
2015-03-13 10:07 ` Wang Nan [this message]
2015-03-13 11:20 ` Namhyung Kim
2015-03-13 12:51 ` [PATCH] perf: report: don't allow empty argument for '-t' Wang Nan
2015-03-16 2:20 ` Namhyung Kim
2015-03-19 6:41 ` Wang Nan
2015-03-19 7:26 ` Namhyung Kim
2015-03-19 14:00 ` Arnaldo Carvalho de Melo
2015-03-19 14:19 ` Namhyung Kim
2015-03-22 10:13 ` [tip:perf/core] perf report: Don't " tip-bot for Wang Nan
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=5502B6E6.2050204@huawei.com \
--to=wangnan0@huawei.com \
--cc=acme@kernel.org \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lizefan@huawei.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=pi3orama@163.com \
/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
Powered by JetHome