[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190703081657.GD6852@leoy-ThinkPad-X240s>
Date: Wed, 3 Jul 2019 16:16:57 +0800
From: Leo Yan <leo.yan@...aro.org>
To: Adrian Hunter <adrian.hunter@...el.com>
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>,
Jiri Olsa <jolsa@...hat.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>,
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 10/11] perf intel-pt: Smatch: Fix potential NULL
pointer dereference
On Wed, Jul 03, 2019 at 08:19:19AM +0300, Adrian Hunter wrote:
> On 3/07/19 4:35 AM, Leo Yan wrote:
> > Hi Adrian,
> >
> > On Tue, Jul 02, 2019 at 02:07:40PM +0300, Adrian Hunter wrote:
> >> On 2/07/19 1:34 PM, Leo Yan wrote:
> >>> Based on the following report from Smatch, fix the potential
> >>> NULL pointer dereference check.
> >>
> >> It never is NULL. Remove the NULL test if you want:
> >>
> >> - if (session->itrace_synth_opts && session->itrace_synth_opts->set) {
> >> + if (session->itrace_synth_opts->set) {
> >>
> >> But blindly making changes like below is questionable.
> >
> > Thanks for suggestions.
> >
> > I checked report and script commands, as you said, both command will
> > always set session->itrace_synth_opts. For these two commands, we can
> > safely remove the NULL test.
> >
> > Because perf tool contains many sub commands, so I don't have much
> > confidence it's very safe to remove the NULL test for all cases; e.g.
> > there have cases which will process aux trace buffer but without
> > itrace options; for this case, session->itrace_synth_opts might be NULL.
> >
> > For either way (remove NULL test or keep NULL test), I don't want to
> > introduce regression and extra efforts by my patch. So want to double
> > confirm with you for this :)
>
> Yes, intel_pt_process_auxtrace_info() only gets called if a tool sets up the
> tools->auxtrace_info() callback. The tools that do that also set
> session->itrace_synth_opts.
Yes.
I also checked the another case for 'perf inject', just as you said,
it sets both inject->tool.auxtrace_info and session->itrace_synth_opts
if we use 'itrace' option. So it's safe to remove the NULL test for
session->itrace_synth_opts.
Will follow your suggestion for new patches. Thanks a lot for
confirmation and suggestions.
Thanks,
Leo Yan
Powered by blists - more mailing lists