Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752761AbbH1Gmu (ORCPT ); Fri, 28 Aug 2015 02:42:50 -0400 Received: from terminus.zytor.com ([198.137.202.10]:54809 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751605AbbH1Gmt (ORCPT ); Fri, 28 Aug 2015 02:42:49 -0400 Date: Thu, 27 Aug 2015 23:42:32 -0700 From: tip-bot for Wang Nan Message-ID: Cc: rostedt@goodmis.org, wangnan0@huawei.com, namhyung@kernel.org, hpa@zytor.com, linux-kernel@vger.kernel.org, acme@redhat.com, mingo@kernel.org, masami.hiramatsu.pt@hitachi.com, tglx@linutronix.de, lizefan@huawei.com Reply-To: masami.hiramatsu.pt@hitachi.com, lizefan@huawei.com, tglx@linutronix.de, wangnan0@huawei.com, rostedt@goodmis.org, mingo@kernel.org, acme@redhat.com, linux-kernel@vger.kernel.org, hpa@zytor.com, namhyung@kernel.org In-Reply-To: <1440586666-235233-6-git-send-email-wangnan0@huawei.com> References: <1440586666-235233-6-git-send-email-wangnan0@huawei.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf probe: Fix error reported when offset without function Git-Commit-ID: 6c6e024f0a62a6a08c06002fd3caa2307cc54fd0 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2071 Lines: 62 Commit-ID: 6c6e024f0a62a6a08c06002fd3caa2307cc54fd0 Gitweb: http://git.kernel.org/tip/6c6e024f0a62a6a08c06002fd3caa2307cc54fd0 Author: Wang Nan AuthorDate: Wed, 26 Aug 2015 10:57:44 +0000 Committer: Arnaldo Carvalho de Melo CommitDate: Wed, 26 Aug 2015 10:40:34 -0300 perf probe: Fix error reported when offset without function 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. Signed-off-by: Wang Nan Acked-by: Masami Hiramatsu Cc: Namhyung Kim Cc: Steven Rostedt Cc: Zefan Li Cc: pi3orama@163.com Link: http://lkml.kernel.org/r/1440586666-235233-6-git-send-email-wangnan0@huawei.com Signed-off-by: Arnaldo Carvalho de Melo --- 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; -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/