Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1757398imu; Wed, 21 Nov 2018 01:16:08 -0800 (PST) X-Google-Smtp-Source: AFSGD/X7q9M1jD8n+8/zRq2TiMqUVgcPDG7rim83phXzyyhbQl1JozB96bErAb65B7evYCm0p3GK X-Received: by 2002:a17:902:a601:: with SMTP id u1mr5934106plq.77.1542791767943; Wed, 21 Nov 2018 01:16:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542791767; cv=none; d=google.com; s=arc-20160816; b=fqGtDr/r5oMeHRSaJ4tU5L3ZOXnO8dlERJR3YatTAl7KlBa+kDMoov/N8uhV3Z3UsU SuxG+1DBcIp676HORjVwK+A/UeJbSxnZjGdTZUtovKfb8mTa6k2conMbZhuwc8AW2iJ+ A6owzHPbzYXU0K61Zp2hSWRllzwUQBx2lpnQfWC1j2UspMmAy8yJJrC6IFFddu0FnfAK tlEb5T+boiMEx81rF7CcT2UTKrmqRRxQwRPNnMRxoYM3FYhqPkHd5Yk3HA3leHzDFvtn fYb07vOZpw3sxfP1mbouEJpWhjiS9nRH842ZtHOKLXUO3RAK4taQUcMjV/ZgHoJiHJ3S 3Khg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:cc:to:subject; bh=NTdVIBCure9cOnolrfLtVjx1ILz0BBh85Y5oZEitN2I=; b=Ay3PF+J52mEf59joKPygRjepFHb9B1Ry2KWHFcX86D0YvGm9KPQ4GIuIaEDfbpMf0T k3E5z/+UqtZFA5GDlsbJ6ZkVpPc+1M1iDnb/abpvlq01FP683rZsb07U4m5jq1rQZxrv GcuB6mRSLio2zhiiypMkOy4KA9BgfjuLN7FLScboAHP7uqSwkDjqoFj8BbZapM+6m9E0 DyacdAj3VeQKNiQb2DkE5bl6ceCdxT3/L6LY0Eu+WAGG023ZY/0yaiLUILNoccRdhG87 f8gVuWnNcCJ8sIdJSFUbnI2NynB1Bedqh5jhpmAXkPw0iEBvWR8XZYuAI/Da5lMVOVjU WG1Q== ARC-Authentication-Results: i=1; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s17si44854363pgi.513.2018.11.21.01.15.52; Wed, 21 Nov 2018 01:16:07 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729264AbeKUTsn (ORCPT + 99 others); Wed, 21 Nov 2018 14:48:43 -0500 Received: from mga12.intel.com ([192.55.52.136]:52849 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726665AbeKUTsn (ORCPT ); Wed, 21 Nov 2018 14:48:43 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Nov 2018 01:15:01 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,260,1539673200"; d="scan'208";a="110092622" Received: from ahunter-desktop.fi.intel.com (HELO [10.237.72.130]) ([10.237.72.130]) by orsmga001.jf.intel.com with ESMTP; 21 Nov 2018 01:14:58 -0800 Subject: Re: [PATCH 4/4] perf intel-pt/bts: fix potential NULL pointer dereference in intel_bts_process_auxtrace_info To: Wen Yang , peterz@infradead.org Cc: mingo@redhat.com, acme@kernel.org, alexander.shishkin@linux.intel.com, jolsa@redhat.com, namhyung@kernel.org, ak@linux.intel.com, linux-kernel@vger.kernel.org, zhong.weidong@zte.com.cn, wang.yi59@zte.com.cn, Julia Lawall References: <1542786220-19338-1-git-send-email-wen.yang99@zte.com.cn> From: Adrian Hunter Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Message-ID: <60a8972e-037f-8d6b-ce45-76b65a841156@intel.com> Date: Wed, 21 Nov 2018 11:13:24 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.1 MIME-Version: 1.0 In-Reply-To: <1542786220-19338-1-git-send-email-wen.yang99@zte.com.cn> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 21/11/18 9:43 AM, Wen Yang wrote: > This patch fixes a possible null pointer dereference in > intel_bts_process_auxtrace_info, detected by the semantic patch > deref_null.cocci, with the following warning: > > ./tools/perf/util/intel-bts.c:921:32-49: ERROR: session -> itrace_synth_opts is NULL but dereferenced. > > Signed-off-by: Wen Yang > Reviewed-by: Tan Hu > CC: Julia Lawall > --- > tools/perf/util/intel-bts.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/tools/perf/util/intel-bts.c b/tools/perf/util/intel-bts.c > index 7b27d77..b0258f4 100644 > --- a/tools/perf/util/intel-bts.c > +++ b/tools/perf/util/intel-bts.c > @@ -917,7 +917,8 @@ int intel_bts_process_auxtrace_info(union perf_event *event, > if (session->itrace_synth_opts && session->itrace_synth_opts->set) { > bts->synth_opts = *session->itrace_synth_opts; > } else { > - itrace_synth_opts__set_default(&bts->synth_opts, > + if (session->itrace_synth_opts) > + itrace_synth_opts__set_default(&bts->synth_opts, > session->itrace_synth_opts->default_no_sample); > if (session->itrace_synth_opts) > bts->synth_opts.thread_stack = > See response to patch 1.