Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1726838imu; Wed, 21 Nov 2018 00:42:43 -0800 (PST) X-Google-Smtp-Source: AFSGD/U/d4/36sc9B9ZZ7QV/+mk/CdfgzaxN9ohO3fU0I2HvaDbsocL858PryzO0iXlpbraOlR3R X-Received: by 2002:a63:e055:: with SMTP id n21mr5167039pgj.397.1542789762993; Wed, 21 Nov 2018 00:42:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542789762; cv=none; d=google.com; s=arc-20160816; b=l+EnyR0D+8SEaHDNv1q/2nQtEL0q7UCN8hrMm5jORFuhblP/kr07Jy6vO/UtAokecH SCGj0vaWb13fs462j3RiFTr2kDbjKzbEHrO3eiULEyH5rIWWGHSD/F9uztIQZECLzMbQ NXUKQpTJgQYViF5CeSsoAGT8lYFyej8bYpsQS8KWwUmTm76+IQPNsZs9Mh+5obzdnv5l VPXP53DBKfDRFmzSQAJ8s52igI1IDFu2bCmfmlX9Cnq7u8zv9WnieDe9VrnN1UvBUQuH 9t0ozbMFkIAemXpwR9wKAq7VKGjNSDBrzY3Q8wCQ/gtQpOnrifc2D7w7/YhOIWQBDolF NAWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=YZ3SNyiYfEb42hmS7tlHJSG4HLiNZczy6NyXRGUCTYQ=; b=efuL/xreeDD59gucW9ESZabQ4iVte7PPeiEAM3sNEjZW/Bq1MmW4/EOGatzlq8zhiH OrKGrtGv7cJu3CoCGyXOdBOS/k2agJxaGzUZwXkayfGQJpHEuf3PO58hkUwiPF8sLSfD QLNMBWznSCFnCEBSrPCNYwffpYFN/x2lwhbu4ytz1LEMUb1qxjxOHOL8tzK76sJbFjNA 7bcGheem+l/zKp4Q3hmL/6jBAyoKMV2vBDZRXoiS+s2g6V6UJJhXUDVf7mzIkXC3ZjYu R52SkKC2PdrCqkvkT7Wwuh6grzht5WcDdPhcfPO85zrdcGqW2rdilwdk7ZHYfUhWOIYx dceg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l23si44798513pgh.533.2018.11.21.00.42.28; Wed, 21 Nov 2018 00:42:42 -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 S1728127AbeKUSPr (ORCPT + 99 others); Wed, 21 Nov 2018 13:15:47 -0500 Received: from out1.zte.com.cn ([202.103.147.172]:43892 "EHLO mxct.zte.com.cn" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725999AbeKUSPr (ORCPT ); Wed, 21 Nov 2018 13:15:47 -0500 Received: from mse01.zte.com.cn (unknown [10.30.3.20]) by Forcepoint Email with ESMTPS id B911D9CA145E18F7F588; Wed, 21 Nov 2018 15:42:19 +0800 (CST) Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id wAL7gBIT087733; Wed, 21 Nov 2018 15:42:11 +0800 (GMT-8) (envelope-from wen.yang99@zte.com.cn) Received: from fox-host8.localdomain ([10.74.120.8]) by szsmtp06.zte.com.cn (Lotus Domino Release 8.5.3FP6) with ESMTP id 2018112115423327-12071666 ; Wed, 21 Nov 2018 15:42:33 +0800 From: Wen Yang To: peterz@infradead.org Cc: mingo@redhat.com, acme@kernel.org, alexander.shishkin@linux.intel.com, jolsa@redhat.com, namhyung@kernel.org, adrian.hunter@intel.com, ak@linux.intel.com, linux-kernel@vger.kernel.org, zhong.weidong@zte.com.cn, wang.yi59@zte.com.cn, Wen Yang , Julia Lawall Subject: [PATCH 4/4] perf intel-pt/bts: fix potential NULL pointer dereference in intel_bts_process_auxtrace_info Date: Wed, 21 Nov 2018 15:43:40 +0800 Message-Id: <1542786220-19338-1-git-send-email-wen.yang99@zte.com.cn> X-Mailer: git-send-email 1.8.3.1 X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2018-11-21 15:42:33, Serialize by Router on notes_smtp/zte_ltd(Release 9.0.1FP7|August 17, 2016) at 2018-11-21 15:42:03, Serialize complete at 2018-11-21 15:42:03 X-MAIL: mse01.zte.com.cn wAL7gBIT087733 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 = -- 2.9.5