[lkml]   [2019]   [Jul]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH v1 10/11] perf intel-pt: Smatch: Fix potential NULL pointer dereference
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

 \ /
  Last update: 2019-07-03 07:20    [W:0.156 / U:1.256 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site