Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756907AbbHZMVp (ORCPT ); Wed, 26 Aug 2015 08:21:45 -0400 Received: from mail4.hitachi.co.jp ([133.145.228.5]:51621 "EHLO mail4.hitachi.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756694AbbHZMVo (ORCPT ); Wed, 26 Aug 2015 08:21:44 -0400 From: =?utf-8?B?5bmz5p2+6ZuF5bezIC8gSElSQU1BVFXvvIxNQVNBTUk=?= To: "'Wang Nan'" , "acme@kernel.org" , "rostedt@goodmis.org" CC: "mingo@redhat.com" , "namhyung@kernel.org" , "pi3orama@163.com" , "lizefan@huawei.com" , "linux-kernel@vger.kernel.org" , sysp-manager Subject: RE: [PATCH v3 4/6] perf probe: Fix error reported when offset without function Thread-Topic: [PATCH v3 4/6] perf probe: Fix error reported when offset without function Thread-Index: AQHQ3+4oaHXKteQYj06MmgkntdJnWp4eHmZA Date: Wed, 26 Aug 2015 12:21:40 +0000 Message-ID: <50399556C9727B4D88A595C8584AAB37524EC9D0@GSjpTKYDCembx32.service.hitachi.net> References: <1440586666-235233-1-git-send-email-wangnan0@huawei.com> <1440586666-235233-6-git-send-email-wangnan0@huawei.com> In-Reply-To: <1440586666-235233-6-git-send-email-wangnan0@huawei.com> Accept-Language: ja-JP, en-US Content-Language: ja-JP X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.198.219.51] Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by mail.home.local id t7QCLsup024704 Content-Length: 1726 Lines: 59 > From: Wang Nan [mailto:wangnan0@huawei.com] > > This patch fixes a bug that, when offset is provided but function is > lost, parse_perf_probe_point() will give a "" string as function name, > so the checking code at the end of parse_perf_probe_point() become useless. > For example: > > # perf probe +0x1234 > Failed to find symbol in kernel > Error: Failed to add events. > > After this patch: > > # perf probe +0x1234 > Semantic error :Offset requires an entry function. > Error: Command Parse Error. OK, seems sane now :) Acked-by: Masami Hiramatsu Thanks! > > Signed-off-by: Wang Nan > Cc: Arnaldo Carvalho de Melo > Cc: Ingo Molnar > Cc: Masami Hiramatsu > Cc: Namhyung Kim > Cc: Steven Rostedt > --- > tools/perf/util/probe-event.c | 10 +++++++--- > 1 file changed, 7 insertions(+), 3 deletions(-) > > diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c > index 926bcec..eaacb58 100644 > --- a/tools/perf/util/probe-event.c > +++ b/tools/perf/util/probe-event.c > @@ -1194,9 +1194,13 @@ static int parse_perf_probe_point(char *arg, struct perf_probe_event *pev) > *ptr++ = '\0'; > } > > - tmp = strdup(arg); > - if (tmp == NULL) > - return -ENOMEM; > + if (arg[0] == '\0') > + tmp = NULL; > + else { > + tmp = strdup(arg); > + if (tmp == NULL) > + return -ENOMEM; > + } > > if (file_spec) > pp->file = tmp; > -- > 1.8.3.4 ????{.n?+???????+%?????ݶ??w??{.n?+????{??G?????{ay?ʇڙ?,j??f???h?????????z_??(?階?ݢj"???m??????G????????????&???~???iO???z??v?^?m???? ????????I?