[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190702110728.GA15322@krava>
Date: Tue, 2 Jul 2019 13:07:28 +0200
From: Jiri Olsa <jolsa@...hat.com>
To: Leo Yan <leo.yan@...aro.org>
Cc: Arnaldo Carvalho de Melo <acme@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Namhyung Kim <namhyung@...nel.org>,
Mathieu Poirier <mathieu.poirier@...aro.org>,
Suzuki K Poulose <suzuki.poulose@....com>,
Andi Kleen <ak@...ux.intel.com>,
"David S. Miller" <davem@...emloft.net>,
Davidlohr Bueso <dave@...olabs.net>,
Rasmus Villemoes <linux@...musvillemoes.dk>,
Jin Yao <yao.jin@...ux.intel.com>,
Song Liu <songliubraving@...com>,
Adrian Hunter <adrian.hunter@...el.com>,
Alexios Zavras <alexios.zavras@...el.com>,
Thomas Gleixner <tglx@...utronix.de>,
Changbin Du <changbin.du@...el.com>,
Eric Saint-Etienne <eric.saint.etienne@...cle.com>,
Konstantin Khlebnikov <khlebnikov@...dex-team.ru>,
Thomas Richter <tmricht@...ux.ibm.com>,
Alexey Budankov <alexey.budankov@...ux.intel.com>,
linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH v1 06/11] perf hists: Smatch: Fix potential NULL pointer
dereference
On Tue, Jul 02, 2019 at 06:34:15PM +0800, Leo Yan wrote:
> 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@...aro.org>
> ---
> tools/perf/ui/browsers/hists.c | 13 +++++++++----
> 1 file changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
> index 3421ecbdd3f0..2ba33040ddd8 100644
> --- a/tools/perf/ui/browsers/hists.c
> +++ b/tools/perf/ui/browsers/hists.c
> @@ -638,7 +638,9 @@ int hist_browser__run(struct hist_browser *browser, const char *help,
> switch (key) {
> case K_TIMER: {
not sure this can really happen, perhaps WARN_ON_ONCE(!hbt) would be
good in here
jirka
> u64 nr_entries;
> - hbt->timer(hbt->arg);
> +
> + if (hbt)
> + hbt->timer(hbt->arg);
>
> if (hist_browser__has_filter(browser) ||
> symbol_conf.report_hierarchy)
SNIP
Powered by blists - more mailing lists