From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753852AbbCMKI1 (ORCPT ); Fri, 13 Mar 2015 06:08:27 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:1069 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751100AbbCMKIY (ORCPT ); Fri, 13 Mar 2015 06:08:24 -0400 Message-ID: <5502B6E6.2050204@huawei.com> Date: Fri, 13 Mar 2015 18:07:34 +0800 From: Wang Nan User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Thunderbird/24.0.1 MIME-Version: 1.0 To: Namhyung Kim CC: , , , , , Subject: Re: [PATCH] perf: fix a segfault problem. References: <1426236092-197137-1-git-send-email-wangnan0@huawei.com> <20150313094615.GC10836@danjae.skbroadband> In-Reply-To: <20150313094615.GC10836@danjae.skbroadband> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.111.69.129] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 >> --- >> 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 >>