Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758404AbbKHHbV (ORCPT ); Sun, 8 Nov 2015 02:31:21 -0500 Received: from terminus.zytor.com ([198.137.202.10]:46030 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758380AbbKHHbS (ORCPT ); Sun, 8 Nov 2015 02:31:18 -0500 Date: Sat, 7 Nov 2015 23:31:04 -0800 From: tip-bot for Wang Nan Message-ID: Cc: wangnan0@huawei.com, acme@redhat.com, linux-kernel@vger.kernel.org, lizefan@huawei.com, namhyung@kernel.org, hpa@zytor.com, tglx@linutronix.de, jolsa@kernel.org, masami.hiramatsu.pt@hitachi.com, mingo@kernel.org Reply-To: acme@redhat.com, lizefan@huawei.com, linux-kernel@vger.kernel.org, wangnan0@huawei.com, hpa@zytor.com, namhyung@kernel.org, tglx@linutronix.de, jolsa@kernel.org, masami.hiramatsu.pt@hitachi.com, mingo@kernel.org In-Reply-To: <1446729565-27592-3-git-send-email-wangnan0@huawei.com> References: <1446729565-27592-3-git-send-email-wangnan0@huawei.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/urgent] perf tools: Fix find_perf_probe_point_from_map( ) which incorrectly returns success Git-Commit-ID: 98d3b258ede2cdac31a2728543f652964e597e79 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: 1933 Lines: 48 Commit-ID: 98d3b258ede2cdac31a2728543f652964e597e79 Gitweb: http://git.kernel.org/tip/98d3b258ede2cdac31a2728543f652964e597e79 Author: Wang Nan AuthorDate: Thu, 5 Nov 2015 13:19:25 +0000 Committer: Arnaldo Carvalho de Melo CommitDate: Thu, 5 Nov 2015 12:47:52 -0300 perf tools: Fix find_perf_probe_point_from_map() which incorrectly returns success It is possible that find_perf_probe_point_from_map() fails to find a symbol but still returns 0 because of an small error when coding: find_perf_probe_point_from_map() set 'ret' to error code at first, but also use it to hold return value of kernel_get_symbol_address_by_name(). This patch resets 'ret' to error even kernel_get_symbol_address_by_name() success, so if !sym, the whole function returns error correctly. Signed-off-by: Wang Nan Cc: Jiri Olsa Cc: Masami Hiramatsu Cc: Namhyung Kim Cc: Zefan Li Cc: pi3orama@163.com Link: http://lkml.kernel.org/r/1446729565-27592-3-git-send-email-wangnan0@huawei.com Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/probe-event.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c index b51a8bf..e659c4f 100644 --- a/tools/perf/util/probe-event.c +++ b/tools/perf/util/probe-event.c @@ -1905,6 +1905,9 @@ static int find_perf_probe_point_from_map(struct probe_trace_point *tp, sym = __find_kernel_function(addr, &map); } } + + /* ret may has be overwritten so reset it */ + ret = -ENOENT; if (!sym) goto out; -- 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/