From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.5 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C6B8AC606D1 for ; Mon, 8 Jul 2019 21:57:51 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9DE8E2086D for ; Mon, 8 Jul 2019 21:57:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="H4B1XhAg" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9DE8E2086D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=HFwZ+5e+pWmeTLOHKVqcY98la3sc+x+Sv9NYqD2AeXI=; b=H4B1XhAgelt8oC tRnRmnKmI+nowMIV1245xCOZ6MTcuQMOl/V2LPBDEf5omTymeko+0BJMk/IO7sVkrMm62MGswHYEq 1rbZTWaUkuNIbNyGa7/kVpqug5IWtfpjdpmcT3hiWShqgGnI8AGzXdRhCZs4zFsmta+hBm18cQfsc qnsy76QgJX7mHK9sNyusJ/NAGYURs0iGyU2w4OLZ/CDQ7W+bIEnnoHld2OUTYIsZ6XzybTaqsdCxR gCTNWpgYv2HieXy5izmpgXbrv1hil+mhTNyAqrD5bGCw9v11Ocaq1Q6pnJpS1TVoRDfaTBGtfEnOb N+19DubUttZ5XwAmNRYw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hkbdn-0007Tb-Mf; Mon, 08 Jul 2019 21:57:43 +0000 Received: from [179.97.35.11] (helo=quaco.ghostprotocols.net) by bombadil.infradead.org with esmtpsa (Exim 4.92 #3 (Red Hat Linux)) id 1hkbdl-0007TR-0u for linux-arm-kernel@lists.infradead.org; Mon, 08 Jul 2019 21:57:41 +0000 Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id 2081B40340; Mon, 8 Jul 2019 18:57:38 -0300 (-03) Date: Mon, 8 Jul 2019 18:57:38 -0300 From: Arnaldo Carvalho de Melo To: Mathieu Poirier Subject: Re: [PATCH v2 4/4] perf cs-etm: Smatch: Fix potential NULL pointer dereference Message-ID: <20190708215738.GC7455@kernel.org> References: <20190708143937.7722-1-leo.yan@linaro.org> <20190708143937.7722-5-leo.yan@linaro.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Url: http://acmel.wordpress.com User-Agent: Mutt/1.12.0 (2019-05-25) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andi Kleen , Suzuki K Poulose , Alexander Shishkin , Adrian Hunter , Linux Kernel Mailing List , Leo Yan , Namhyung Kim , Jiri Olsa , linux-arm-kernel Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org Em Mon, Jul 08, 2019 at 11:38:48AM -0600, Mathieu Poirier escreveu: > On Mon, 8 Jul 2019 at 08:40, Leo Yan wrote: > > > > Based on the following report from Smatch, fix the potential > > NULL pointer dereference check. > > > > tools/perf/util/cs-etm.c:2545 > > cs_etm__process_auxtrace_info() error: we previously assumed > > 'session->itrace_synth_opts' could be null (see line 2541) > > > > tools/perf/util/cs-etm.c > > 2541 if (session->itrace_synth_opts && session->itrace_synth_opts->set) { > > 2542 etm->synth_opts = *session->itrace_synth_opts; > > 2543 } else { > > 2544 itrace_synth_opts__set_default(&etm->synth_opts, > > 2545 session->itrace_synth_opts->default_no_sample); > > ^^^^^^^^^^^^^^^^^^^^^^^^^^ > > 2546 etm->synth_opts.callchain = false; > > 2547 } > > > > 'session->itrace_synth_opts' is impossible to be a NULL pointer in > > cs_etm__process_auxtrace_info(), thus this patch removes the NULL > > test for 'session->itrace_synth_opts'. > > > > Signed-off-by: Leo Yan > > --- > > tools/perf/util/cs-etm.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c > > index ad43a6e31827..ab578a06a790 100644 > > --- a/tools/perf/util/cs-etm.c > > +++ b/tools/perf/util/cs-etm.c > > @@ -2537,7 +2537,7 @@ int cs_etm__process_auxtrace_info(union perf_event *event, > > return 0; > > } > > > > - if (session->itrace_synth_opts && session->itrace_synth_opts->set) { > > + if (session->itrace_synth_opts->set) { > > etm->synth_opts = *session->itrace_synth_opts; > > } else { > > itrace_synth_opts__set_default(&etm->synth_opts, > > This is in accordance with what was previously discussed. > > Reviewed-by: Mathieu Poirier Thanks, applied. - Arnaldo _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel