From patchwork Thu Nov 5 13:19:25 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wang Nan X-Patchwork-Id: 56041 Delivered-To: patch@linaro.org Received: by 10.112.61.134 with SMTP id p6csp401445lbr; Thu, 5 Nov 2015 05:20:11 -0800 (PST) X-Received: by 10.68.125.197 with SMTP id ms5mr9371401pbb.161.1446729610977; Thu, 05 Nov 2015 05:20:10 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ia2si10177407pbb.85.2015.11.05.05.20.10; Thu, 05 Nov 2015 05:20:10 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1032624AbbKENUG (ORCPT + 28 others); Thu, 5 Nov 2015 08:20:06 -0500 Received: from szxga02-in.huawei.com ([119.145.14.65]:22315 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1031209AbbKENUE (ORCPT ); Thu, 5 Nov 2015 08:20:04 -0500 Received: from 172.24.1.51 (EHLO szxeml422-hub.china.huawei.com) ([172.24.1.51]) by szxrg02-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id CVT67438; Thu, 05 Nov 2015 21:19:45 +0800 (CST) Received: from linux-4hy3.site (10.107.193.248) by szxeml422-hub.china.huawei.com (10.82.67.152) with Microsoft SMTP Server id 14.3.235.1; Thu, 5 Nov 2015 21:19:36 +0800 From: Wang Nan To: , CC: , , , , , Wang Nan , Arnaldo Carvalho de Melo Subject: [PATCH 2/2] perf tools: Fix find_perf_probe_point_from_map() which incorrectly returns success Date: Thu, 5 Nov 2015 13:19:25 +0000 Message-ID: <1446729565-27592-3-git-send-email-wangnan0@huawei.com> X-Mailer: git-send-email 1.8.3.4 In-Reply-To: <1446729565-27592-1-git-send-email-wangnan0@huawei.com> References: <1446729565-27592-1-git-send-email-wangnan0@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.107.193.248] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020201.563B5772.02A4,ss=1,re=0.000,fgs=0, ip=0.0.0.0, so=2013-06-18 04:22:30, dmn=2011-05-27 18:58:46 X-Mirapoint-Loop-Id: 980ca91f466d995a8938bf9924779fa3 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org It is possible that find_perf_probe_point_from_map() fails to find 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: Arnaldo Carvalho de Melo Cc: Jiri Olsa Cc: Masami Hiramatsu Cc: Namhyung Kim --- tools/perf/util/probe-event.c | 3 +++ 1 file changed, 3 insertions(+) -- 1.8.3.4 -- 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/ 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;