lkml.org 
[lkml]   [2022]   [Mar]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] perf parse-events: Fix null check
From
On 11/03/2022 13:06, Weiguo Li wrote:
> We did a null check after "tmp->symbol = strdup(...)", but we checked
> "list->symbol" other than "tmp->symbol".
>
> Signed-off-by: Weiguo Li <liwg06@foxmail.com>

Reviewed-by: John Garry <john.garry@huawei.com>

> ---
> tools/perf/util/parse-events.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
> index 9739b05b999e..dfb50a5f83d0 100644
> --- a/tools/perf/util/parse-events.c
> +++ b/tools/perf/util/parse-events.c
> @@ -2193,7 +2193,7 @@ int perf_pmu__test_parse_init(void)
> for (i = 0; i < ARRAY_SIZE(symbols); i++, tmp++) {
> tmp->type = symbols[i].type;
> tmp->symbol = strdup(symbols[i].symbol);
> - if (!list->symbol)
> + if (!tmp->symbol)
> goto err_free;
> }
>

\
 
 \ /
  Last update: 2022-03-11 15:00    [W:0.049 / U:0.244 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site