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 <[email protected]> Signed-off-by: Fushuai Wang <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Kan Liang <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Signed-off-by: Arnaldo Carvalho de Melo <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
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)