linux/tools/perf
Leo Yan 323fd74982 perf intel-pt: Fix potential NULL pointer dereference found by the smatch tool
Based on the following report from Smatch, fix the potential NULL
pointer dereference check.

  tools/perf/util/intel-pt.c:3200
  intel_pt_process_auxtrace_info() error: we previously assumed
  'session->itrace_synth_opts' could be null (see line 3196)

  tools/perf/util/intel-pt.c:3206
  intel_pt_process_auxtrace_info() warn: variable dereferenced before
  check 'session->itrace_synth_opts' (see line 3200)

  tools/perf/util/intel-pt.c
  3196         if (session->itrace_synth_opts && session->itrace_synth_opts->set) {
  3197                 pt->synth_opts = *session->itrace_synth_opts;
  3198         } else {
  3199                 itrace_synth_opts__set_default(&pt->synth_opts,
  3200                                 session->itrace_synth_opts->default_no_sample);
                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^
  3201                 if (!session->itrace_synth_opts->default_no_sample &&
  3202                     !session->itrace_synth_opts->inject) {
  3203                         pt->synth_opts.branches = false;
  3204                         pt->synth_opts.callchain = true;
  3205                 }
  3206                 if (session->itrace_synth_opts)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  3207                         pt->synth_opts.thread_stack =
  3208                                 session->itrace_synth_opts->thread_stack;
  3209         }

'session->itrace_synth_opts' is impossible to be a NULL pointer in
intel_pt_process_auxtrace_info(), thus this patch removes the NULL test
for 'session->itrace_synth_opts'.

Signed-off-by: Leo Yan <leo.yan@linaro.org>
Acked-by: 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: Mathieu Poirier <mathieu.poirier@linaro.org>
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-4-leo.yan@linaro.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2019-07-09 10:13:28 -03:00
..
Documentation perf tools: Fix typos / broken sentences 2019-07-02 16:08:16 -03:00
arch tools lib: Adopt zalloc()/zfree() from tools/perf 2019-07-09 10:13:26 -03:00
bench perf tools: Use zfree() where applicable 2019-07-09 10:13:27 -03:00
examples/bpf perf augmented_raw_syscalls: Move reading filename to the loop 2019-06-05 09:48:55 -03:00
include/bpf perf bpf: Automatically add BTF ELF markers 2019-03-06 09:45:37 -03:00
jvmti tools build: Check if gettid() is available before providing helper 2019-07-07 17:53:09 -03:00
pmu-events perf tools: Use list_del_init() more thorougly 2019-07-09 10:13:27 -03:00
python treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 407 2019-06-05 17:37:14 +02:00
scripts perf scripts python: export-to-sqlite.py: Fix DROP VIEW power_events_view 2019-07-09 10:13:28 -03:00
tests perf tools: Use list_del_init() more thorougly 2019-07-09 10:13:27 -03:00
trace perf trace: Beautify 'sync_file_range' arguments 2019-05-28 18:37:43 -03:00
ui perf hists browser: Fix potential NULL pointer dereference found by the smatch tool 2019-07-09 10:13:27 -03:00
util perf intel-pt: Fix potential NULL pointer dereference found by the smatch tool 2019-07-09 10:13:28 -03:00
.gitignore perf tools: Add trace/beauty/generated/ into .gitignore 2018-02-05 13:58:02 -03:00
Build perf tools: Rename build libperf to perf 2019-02-14 15:18:08 -03:00
CREDITS
MANIFEST tools lib: Adopt zalloc()/zfree() from tools/perf 2019-07-09 10:13:26 -03:00
Makefile perf tools: Disable parallelism for 'make clean' 2018-08-20 08:54:58 -03:00
Makefile.config tools build: Check if gettid() is available before providing helper 2019-07-07 17:53:09 -03:00
Makefile.perf Linux 5.2-rc3 2019-06-03 11:56:35 +02:00
builtin-annotate.c tools lib: Adopt zalloc()/zfree() from tools/perf 2019-07-09 10:13:26 -03:00
builtin-bench.c tools lib: Adopt zalloc()/zfree() from tools/perf 2019-07-09 10:13:26 -03:00
builtin-buildid-cache.c perf data: Add global path holder 2019-02-22 16:52:07 -03:00
builtin-buildid-list.c perf data: Add global path holder 2019-02-22 16:52:07 -03:00
builtin-c2c.c tools lib: Adopt zalloc()/zfree() from tools/perf 2019-07-09 10:13:26 -03:00
builtin-config.c perf tools: Add missing headers, mostly stdlib.h 2019-07-09 10:13:22 -03:00
builtin-data.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
builtin-diff.c tools lib: Adopt zalloc()/zfree() from tools/perf 2019-07-09 10:13:26 -03:00
builtin-evlist.c perf data: Add global path holder 2019-02-22 16:52:07 -03:00
builtin-ftrace.c perf tools: Use list_del_init() more thorougly 2019-07-09 10:13:27 -03:00
builtin-help.c tools lib: Adopt zalloc()/zfree() from tools/perf 2019-07-09 10:13:26 -03:00
builtin-inject.c perf inject: The tool->read() call may pass a NULL evsel, handle it 2019-07-09 09:33:55 -03:00
builtin-kallsyms.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 251 2019-06-05 17:30:26 +02:00
builtin-kmem.c tools lib: Adopt zalloc()/zfree() from tools/perf 2019-07-09 10:13:26 -03:00
builtin-kvm.c tools lib: Adopt zalloc()/zfree() from tools/perf 2019-07-09 10:13:26 -03:00
builtin-list.c perf list: Output tool events 2019-04-01 14:49:25 -03:00
builtin-lock.c perf tools: Use list_del_init() more thorougly 2019-07-09 10:13:27 -03:00
builtin-mem.c perf data: Add global path holder 2019-02-22 16:52:07 -03:00
builtin-probe.c tools lib: Adopt zalloc()/zfree() from tools/perf 2019-07-09 10:13:26 -03:00
builtin-record.c perf tools: Use zfree() where applicable 2019-07-09 10:13:27 -03:00
builtin-report.c tools lib: Adopt zalloc()/zfree() from tools/perf 2019-07-09 10:13:26 -03:00
builtin-sched.c tools lib: Adopt zalloc()/zfree() from tools/perf 2019-07-09 10:13:26 -03:00
builtin-script.c perf script: Assume native_arch for pipe mode 2019-07-09 10:13:28 -03:00
builtin-stat.c perf tools: Use zfree() where applicable 2019-07-09 10:13:27 -03:00
builtin-timechart.c tools lib: Adopt zalloc()/zfree() from tools/perf 2019-07-09 10:13:26 -03:00
builtin-top.c perf top: Fix potential NULL pointer dereference detected by the smatch tool 2019-07-09 09:33:54 -03:00
builtin-trace.c tools lib: Adopt zalloc()/zfree() from tools/perf 2019-07-09 10:13:26 -03:00
builtin-version.c tools build: Implement libzstd feature check, LIBZSTD_DIR and NO_LIBZSTD defines 2019-04-01 15:18:10 -03:00
builtin.h perf script: Add array bound checking to list_scripts 2019-03-11 16:33:19 -03:00
check-headers.sh tools perf: Move from sane_ctype.h obtained from git to the Linux's original 2019-06-25 21:02:47 -03:00
command-list.txt perf help: Add missing subcommand `version` 2018-09-19 14:53:36 -03:00
design.txt perf/doc: Update design.txt for exclude_{host|guest} flags 2019-01-21 11:01:18 +01:00
perf-archive.sh License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
perf-completion.sh perf tools: Auto-complete for events with ':' 2017-12-27 12:16:00 -03:00
perf-read-vdso.c perf tools: Make find_vdso_map() more modular 2019-01-08 13:28:13 -03:00
perf-sys.h Drop a bunch of metag references 2018-02-23 14:29:59 +00:00
perf-with-kcore.sh Merge branch 'x86/cpu' into perf/core, to pick up dependent changes 2019-06-17 12:29:16 +02:00
perf.c tools lib: Adopt zalloc()/zfree() from tools/perf 2019-07-09 10:13:26 -03:00
perf.h perf tools: Increase MAX_NR_CPUS and MAX_CACHES 2019-06-25 08:47:10 -03:00