From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755904AbbESNIg (ORCPT ); Tue, 19 May 2015 09:08:36 -0400 Received: from mga03.intel.com ([134.134.136.65]:30713 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755686AbbESNIN (ORCPT ); Tue, 19 May 2015 09:08:13 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,458,1427785200"; d="scan'208";a="712431515" From: Adrian Hunter To: Arnaldo Carvalho de Melo Cc: linux-kernel@vger.kernel.org, Jiri Olsa , Namhyung Kim Subject: [PATCH 5/5] perf tools: Fix data_read_offset() file opening Date: Tue, 19 May 2015 16:05:46 +0300 Message-Id: <1432040746-1755-6-git-send-email-adrian.hunter@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1432040746-1755-1-git-send-email-adrian.hunter@intel.com> References: <1432040746-1755-1-git-send-email-adrian.hunter@intel.com> Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Patch "perf tools: Protect dso cache fd with a mutex" changed data_file_size() to open the data file if it was not open. data_read_offset() was calling data_file_size() to read the data file size, but data_file_size() can fail to open the file because the binary_type has not been set up. The correct function to call is dso__data_size() which uses dso__data_fd() to open the file correctly. Signed-off-by: Adrian Hunter --- tools/perf/util/dso.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c index 1b96c8d..e248f56 100644 --- a/tools/perf/util/dso.c +++ b/tools/perf/util/dso.c @@ -756,7 +756,7 @@ off_t dso__data_size(struct dso *dso, struct machine *machine) static ssize_t data_read_offset(struct dso *dso, struct machine *machine, u64 offset, u8 *data, ssize_t size) { - if (data_file_size(dso, machine)) + if (dso__data_size(dso, machine) < 0) return -1; /* Check the offset sanity. */ -- 1.9.1