Skip to content

Commit 1f823c6

Browse files
Fushuai Wanggregkh
authored andcommitted
perf trace: Fix IS_ERR() vs NULL check bug
[ Upstream commit b0f4ade ] The alloc_syscall_stats() function always returns an error pointer (ERR_PTR) on failure. So replace NULL check with IS_ERR() check after calling alloc_syscall_stats() function. Fixes: fc00897 ("perf trace: Add --summary-mode option") Reviewed-by: Ian Rogers <irogers@google.com> Signed-off-by: Fushuai Wang <wangfushuai@baidu.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Kan Liang <kan.liang@linux.intel.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 855a8ef commit 1f823c6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tools/perf/builtin-trace.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4440,7 +4440,7 @@ static int trace__run(struct trace *trace, int argc, const char **argv)
44404440

44414441
if (trace->summary_mode == SUMMARY__BY_TOTAL && !trace->summary_bpf) {
44424442
trace->syscall_stats = alloc_syscall_stats();
4443-
if (trace->syscall_stats == NULL)
4443+
if (IS_ERR(trace->syscall_stats))
44444444
goto out_delete_evlist;
44454445
}
44464446

@@ -4748,7 +4748,7 @@ static int trace__replay(struct trace *trace)
47484748

47494749
if (trace->summary_mode == SUMMARY__BY_TOTAL) {
47504750
trace->syscall_stats = alloc_syscall_stats();
4751-
if (trace->syscall_stats == NULL)
4751+
if (IS_ERR(trace->syscall_stats))
47524752
goto out;
47534753
}
47544754

0 commit comments

Comments
 (0)