public inbox for linux-arm-kernel@lists.infradead.org 
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel•org>
To: Ingo Molnar <mingo@kernel•org>, Thomas Gleixner <tglx@linutronix•de>
Cc: Arnaldo Carvalho de Melo <acme@redhat•com>,
	Andi Kleen <ak@linux•intel.com>,
	Mathieu Poirier <mathieu.poirier@linaro•org>,
	Suzuki Poulouse <suzuki.poulose@arm•com>,
	Clark Williams <williams@redhat•com>,
	linux-kernel@vger•kernel.org,
	Adrian Hunter <adrian.hunter@intel•com>,
	linux-perf-users@vger•kernel.org,
	Alexander Shishkin <alexander.shishkin@linux•intel.com>,
	Jiri Olsa <jolsa@kernel•org>, Leo Yan <leo.yan@linaro•org>,
	Namhyung Kim <namhyung@kernel•org>, Jiri Olsa <jolsa@redhat•com>,
	linux-arm-kernel@lists•infradead.org
Subject: [PATCH 19/25] perf cs-etm: Fix potential NULL pointer dereference found by the smatch tool
Date: Tue,  9 Jul 2019 15:31:20 -0300	[thread overview]
Message-ID: <20190709183126.30257-20-acme@kernel.org> (raw)
In-Reply-To: <20190709183126.30257-1-acme@kernel.org>

From: Leo Yan <leo.yan@linaro•org>

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 <leo.yan@linaro•org>
Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro•org>
Cc: Adrian Hunter <adrian.hunter@intel•com>
Cc: Alexander Shishkin <alexander.shishkin@linux•intel.com>
Cc: Andi Kleen <ak@linux•intel.com>
Cc: Jiri Olsa <jolsa@redhat•com>
Cc: Namhyung Kim <namhyung@kernel•org>
Cc: Suzuki Poulouse <suzuki.poulose@arm•com>
Cc: linux-arm-kernel@lists•infradead.org
Link: http://lkml.kernel.org/r/20190708143937.7722-5-leo.yan@linaro.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat•com>
---
 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 508e4a3ddc8c..67b88b599a53 100644
--- a/tools/perf/util/cs-etm.c
+++ b/tools/perf/util/cs-etm.c
@@ -2538,7 +2538,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,
-- 
2.21.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists•infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2019-07-09 18:34 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20190709183126.30257-1-acme@kernel.org>
2019-07-09 18:31 ` [PATCH 02/25] perf stat: Fix use-after-freed pointer detected by the smatch tool Arnaldo Carvalho de Melo
2019-07-09 18:31 ` [PATCH 03/25] perf top: Fix potential NULL pointer dereference " Arnaldo Carvalho de Melo
2019-07-09 18:31 ` [PATCH 04/25] perf annotate: Fix dereferencing freed memory found " Arnaldo Carvalho de Melo
2019-07-09 18:31 ` [PATCH 05/25] perf trace: Fix potential NULL pointer dereference " Arnaldo Carvalho de Melo
2019-07-09 18:31 ` [PATCH 06/25] perf map: Fix potential NULL pointer dereference found by " Arnaldo Carvalho de Melo
2019-07-09 18:31 ` [PATCH 08/25] perf session: Fix potential NULL pointer dereference found by the " Arnaldo Carvalho de Melo
2019-07-09 18:31 ` Arnaldo Carvalho de Melo [this message]
2019-07-09 18:31 ` [PATCH 20/25] perf hists browser: " Arnaldo Carvalho de Melo
2019-07-09 18:31 ` [PATCH 24/25] perf intel-bts: " Arnaldo Carvalho de Melo
2019-07-09 18:31 ` [PATCH 25/25] perf intel-pt: " Arnaldo Carvalho de Melo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190709183126.30257-20-acme@kernel.org \
    --to=acme@kernel$(echo .)org \
    --cc=acme@redhat$(echo .)com \
    --cc=adrian.hunter@intel$(echo .)com \
    --cc=ak@linux$(echo .)intel.com \
    --cc=alexander.shishkin@linux$(echo .)intel.com \
    --cc=jolsa@kernel$(echo .)org \
    --cc=jolsa@redhat$(echo .)com \
    --cc=leo.yan@linaro$(echo .)org \
    --cc=linux-arm-kernel@lists$(echo .)infradead.org \
    --cc=linux-kernel@vger$(echo .)kernel.org \
    --cc=linux-perf-users@vger$(echo .)kernel.org \
    --cc=mathieu.poirier@linaro$(echo .)org \
    --cc=mingo@kernel$(echo .)org \
    --cc=namhyung@kernel$(echo .)org \
    --cc=suzuki.poulose@arm$(echo .)com \
    --cc=tglx@linutronix$(echo .)de \
    --cc=williams@redhat$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox