lkml.org 
[lkml]   [2019]   [Jul]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v1 03/11] perf top: Smatch: Fix potential NULL pointer dereference
Em Tue, Jul 02, 2019 at 06:34:12PM +0800, Leo Yan escreveu:
> Based on the following report from Smatch, fix the potential
> NULL pointer dereference check.
>
> tools/perf/builtin-top.c:109
> perf_top__parse_source() warn: variable dereferenced before check 'he'
> (see line 103)
>
> tools/perf/builtin-top.c:233
> perf_top__show_details() warn: variable dereferenced before check 'he'
> (see line 228)
>
> tools/perf/builtin-top.c
> 101 static int perf_top__parse_source(struct perf_top *top, struct hist_entry *he)
> 102 {
> 103 struct perf_evsel *evsel = hists_to_evsel(he->hists);
> ^^^^
> 104 struct symbol *sym;
> 105 struct annotation *notes;
> 106 struct map *map;
> 107 int err = -1;
> 108
> 109 if (!he || !he->ms.sym)
> 110 return -1;
>
> This patch moves the values assignment after validating pointer 'he'.

Applied, thanks,

- Arnaldo

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