Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161464AbbKEOIx (ORCPT ); Thu, 5 Nov 2015 09:08:53 -0500 Received: from mail9.hitachi.co.jp ([133.145.228.44]:50452 "EHLO mail9.hitachi.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030850AbbKEOIw (ORCPT ); Thu, 5 Nov 2015 09:08:52 -0500 From: =?utf-8?B?5bmz5p2+6ZuF5bezIC8gSElSQU1BVFXvvIxNQVNBTUk=?= To: "'Wang Nan'" , "acme@kernel.org" , "namhyung@kernel.org" CC: "lizefan@huawei.com" , "pi3orama@163.com" , "linux-kernel@vger.kernel.org" , "jolsa@kernel.org" , Arnaldo Carvalho de Melo Subject: RE: [PATCH 2/2] perf tools: Fix find_perf_probe_point_from_map() which incorrectly returns success Thread-Topic: [PATCH 2/2] perf tools: Fix find_perf_probe_point_from_map() which incorrectly returns success Thread-Index: AQHRF8ymF/ZtKuEPKE6WPBpva1M0JZ6Naimw Date: Thu, 5 Nov 2015 14:08:48 +0000 Message-ID: <50399556C9727B4D88A595C8584AAB3752604844@GSjpTKYDCembx32.service.hitachi.net> References: <1446729565-27592-1-git-send-email-wangnan0@huawei.com> <1446729565-27592-3-git-send-email-wangnan0@huawei.com> In-Reply-To: <1446729565-27592-3-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 tA5E8vI4020981 Content-Length: 1740 Lines: 49 From: Wang Nan [mailto:wangnan0@huawei.com] > >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(). OK, I didn't expect that there is a symbol which can be found by kernel_get_symbol_address_by_name() but not by __find_kernel_function()... Would you have any example of the error? > >This patch resets 'ret' to error even kernel_get_symbol_address_by_name() >success, so if !sym, the whole function returns error correctly. Hmm, that sounds tricky. I'd rather like to add *psym to kernel_get_symbol_address_by_name() to save symbol and don't use __find_kernel_function() instead. Thank you, > >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(+) > >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; > >-- >1.8.3.4 ????{.n?+???????+%?????ݶ??w??{.n?+????{??G?????{ay?ʇڙ?,j??f???h?????????z_??(?階?ݢj"???m??????G????????????&???~???iO???z??v?^?m???? ????????I?