lkml.org 
[lkml]   [2021]   [Jun]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH 1/3] perf stat: Check return value of asprintf() properly
On Wed, Jun 2, 2021 at 2:22 PM Namhyung Kim <namhyung@kernel.org> wrote:
>
> It returns -1 on error, so checking with 0 would not work.
>
> Fixes: 12279429d862 ("perf stat: Uniquify hybrid event name")
> Cc: Jin Yao <yao.jin@linux.intel.com>
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>

Acked-by: Ian Rogers <irogers@google.com>

Thanks,
Ian

> ---
> tools/perf/util/stat-display.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/perf/util/stat-display.c b/tools/perf/util/stat-display.c
> index b759dfd633b4..04afd41b6067 100644
> --- a/tools/perf/util/stat-display.c
> +++ b/tools/perf/util/stat-display.c
> @@ -564,7 +564,7 @@ static void uniquify_event_name(struct evsel *counter)
> counter->name, counter->pmu_name);
> }
>
> - if (ret) {
> + if (ret > 0) {
> free(counter->name);
> counter->name = new_name;
> }
> --
> 2.32.0.rc0.204.g9fa02ecfa5-goog
>

\
 
 \ /
  Last update: 2021-06-04 06:50    [W:0.074 / U:1.324 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site