Skip to content

Commit b0f4ade

Browse files
Fushuai Wangacmel
authored andcommitted
perf trace: Fix IS_ERR() vs NULL check bug
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>
1 parent 0e9e7bc commit b0f4ade

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
@@ -4441,7 +4441,7 @@ static int trace__run(struct trace *trace, int argc, const char **argv)
44414441

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

@@ -4749,7 +4749,7 @@ static int trace__replay(struct trace *trace)
47494749

47504750
if (trace->summary_mode == SUMMARY__BY_TOTAL) {
47514751
trace->syscall_stats = alloc_syscall_stats();
4752-
if (trace->syscall_stats == NULL)
4752+
if (IS_ERR(trace->syscall_stats))
47534753
goto out;
47544754
}
47554755

0 commit comments

Comments
 (0)