Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: fc00897c8a3f7f57 ("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>

authored by

Fushuai Wang and committed by
Arnaldo Carvalho de Melo
b0f4ade1 0e9e7bc1

+2 -2
+2 -2
tools/perf/builtin-trace.c
··· 4441 4441 4442 4442 if (trace->summary_mode == SUMMARY__BY_TOTAL && !trace->summary_bpf) { 4443 4443 trace->syscall_stats = alloc_syscall_stats(); 4444 - if (trace->syscall_stats == NULL) 4444 + if (IS_ERR(trace->syscall_stats)) 4445 4445 goto out_delete_evlist; 4446 4446 } 4447 4447 ··· 4749 4749 4750 4750 if (trace->summary_mode == SUMMARY__BY_TOTAL) { 4751 4751 trace->syscall_stats = alloc_syscall_stats(); 4752 - if (trace->syscall_stats == NULL) 4752 + if (IS_ERR(trace->syscall_stats)) 4753 4753 goto out; 4754 4754 } 4755 4755