linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] perf parse-events: Fix null check
@ 2022-03-11 13:06 Weiguo Li
  2022-03-11 14:00 ` John Garry
  0 siblings, 1 reply; 3+ messages in thread
From: Weiguo Li @ 2022-03-11 13:06 UTC (permalink / raw)
  To: john.garry, peterz, mingo, acme
  Cc: mark.rutland, alexander.shishkin, jolsa, namhyung,
	linux-perf-users, linux-kernel

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>
---
 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;
 	}
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] perf parse-events: Fix null check
  2022-03-11 13:06 [PATCH] perf parse-events: Fix null check Weiguo Li
@ 2022-03-11 14:00 ` John Garry
  2022-03-12 13:48   ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 3+ messages in thread
From: John Garry @ 2022-03-11 14:00 UTC (permalink / raw)
  To: Weiguo Li, peterz, mingo, acme
  Cc: mark.rutland, alexander.shishkin, jolsa, namhyung,
	linux-perf-users, linux-kernel

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;
>   	}
>   


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] perf parse-events: Fix null check
  2022-03-11 14:00 ` John Garry
@ 2022-03-12 13:48   ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2022-03-12 13:48 UTC (permalink / raw)
  To: John Garry
  Cc: Weiguo Li, peterz, mingo, mark.rutland, alexander.shishkin,
	jolsa, namhyung, linux-perf-users, linux-kernel

Em Fri, Mar 11, 2022 at 02:00:13PM +0000, John Garry escreveu:
> 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>

Thanks, applied.

- Arnaldo

 
> > ---
> >   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;
> >   	}

-- 

- Arnaldo

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-03-12 13:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-11 13:06 [PATCH] perf parse-events: Fix null check Weiguo Li
2022-03-11 14:00 ` John Garry
2022-03-12 13:48   ` Arnaldo Carvalho de Melo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).