[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAP-5=fUvvcfPOEyoTGFD9oahxzKGMZXPZ1YikLqzwE3hw7B=bg@mail.gmail.com>
Date: Wed, 17 Sep 2025 08:31:02 -0700
From: Ian Rogers <irogers@...gle.com>
To: Fushuai Wang <wangfushuai@...du.com>
Cc: peterz@...radead.org, mingo@...hat.com, acme@...nel.org,
namhyung@...nel.org, mark.rutland@....com, alexander.shishkin@...ux.intel.com,
jolsa@...nel.org, adrian.hunter@...el.com, kan.liang@...ux.intel.com,
linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] perf trace: Fix IS_ERR() vs NULL check bug
On Wed, Sep 17, 2025 at 2:54 AM Fushuai Wang <wangfushuai@...du.com> wrote:
>
> 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: fc00897c8a3f ("perf trace: Add --summary-mode option")
> Signed-off-by: Fushuai Wang <wangfushuai@...du.com>
Reviewed-by: Ian Rogers <irogers@...gle.com>
Thanks,
Ian
> ---
> tools/perf/builtin-trace.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
> index fe737b3ac6e6..25c41b89f8ab 100644
> --- a/tools/perf/builtin-trace.c
> +++ b/tools/perf/builtin-trace.c
> @@ -4440,7 +4440,7 @@ static int trace__run(struct trace *trace, int argc, const char **argv)
>
> if (trace->summary_mode == SUMMARY__BY_TOTAL && !trace->summary_bpf) {
> trace->syscall_stats = alloc_syscall_stats();
> - if (trace->syscall_stats == NULL)
> + if (IS_ERR(trace->syscall_stats))
> goto out_delete_evlist;
> }
>
> @@ -4748,7 +4748,7 @@ static int trace__replay(struct trace *trace)
>
> if (trace->summary_mode == SUMMARY__BY_TOTAL) {
> trace->syscall_stats = alloc_syscall_stats();
> - if (trace->syscall_stats == NULL)
> + if (IS_ERR(trace->syscall_stats))
> goto out;
> }
>
> --
> 2.36.1
>
Powered by blists - more mailing lists