linux-stable/tools
Leo Yan 4fe7ea29e4 perf hists browser: Fix potential NULL pointer dereference found by the smatch tool
[ Upstream commit ceb75476db ]

Based on the following report from Smatch, fix the potential
NULL pointer dereference check.

  tools/perf/ui/browsers/hists.c:641
  hist_browser__run() error: we previously assumed 'hbt' could be
  null (see line 625)

  tools/perf/ui/browsers/hists.c:3088
  perf_evsel__hists_browse() error: we previously assumed
  'browser->he_selection' could be null (see line 2902)

  tools/perf/ui/browsers/hists.c:3272
  perf_evsel_menu__run() error: we previously assumed 'hbt' could be
  null (see line 3260)

This patch firstly validating the pointers before access them, so can
fix potential NULL pointer dereference.

Signed-off-by: Leo Yan <leo.yan@linaro.org>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.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-2-leo.yan@linaro.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-07-31 07:27:06 +02:00
..
accounting
arch jump_label: move 'asm goto' support test to Kconfig 2019-06-04 08:02:34 +02:00
bpf tools: bpftool: Fix json dump crash on powerpc 2019-07-26 09:14:16 +02:00
build perf build: Don't unconditionally link the libbfd feature test to -liberty and -lz 2019-02-12 19:47:16 +01:00
cgroup
firewire
gpio
hv Tools: hv: kvp: Fix a warning of buffer overflow with gcc 8.0.1 2019-02-12 19:46:59 +01:00
iio iio: iio-utils: Fix possible incorrect mask calculation 2019-07-31 07:27:02 +02:00
include bpf: fix uapi bpf_prog_info fields alignment 2019-07-26 09:14:15 +02:00
kvm/kvm_stat tools/kvm_stat: fix fields filter for child events 2019-06-19 08:18:05 +02:00
laptop
leds
lib bpf, libbpf, smatch: Fix potential NULL pointer dereference 2019-07-26 09:14:15 +02:00
memory-model tools/memory-model: Rename litmus tests to comply to norm7 2018-07-17 09:30:36 +02:00
nfsd
objtool objtool: Support per-function rodata sections 2019-06-25 11:35:52 +08:00
pci tools: PCI: Add MSI-X support 2018-07-19 11:47:13 +01:00
pcmcia
perf perf hists browser: Fix potential NULL pointer dereference found by the smatch tool 2019-07-31 07:27:06 +02:00
power cpupower : frequency-set -r option misses the last cpu in related cpu list 2019-07-26 09:14:03 +02:00
scripts
spi
testing selftests: bpf: fix inlines in test_lwt_seg6local 2019-07-26 09:14:15 +02:00
thermal/tmon
time
usb usbip: fix vhci_hcd controller counting 2019-04-20 09:16:01 +02:00
virtio virtio: fix test build after uio.h change 2019-01-13 09:51:03 +01:00
vm tools/vm/page-types.c: fix "defined but not used" warning 2018-09-04 16:45:02 -07:00
wmi
Makefile