All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf script perl: Fail check on dynamic allocation
@ 2023-11-20 11:23 zhaimingbing
  2023-11-21  0:30 ` Ian Rogers
  0 siblings, 1 reply; 3+ messages in thread
From: zhaimingbing @ 2023-11-20 11:23 UTC (permalink / raw)
  To: Namhyung Kim, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo, Mark Rutland, Alexander Shishkin,
	Jiri Olsa, Ian Rogers, Adrian Hunter, Sean Christopherson,
	Li Dong
  Cc: linux-perf-users, linux-kernel, zhaimingbing

Return ENOMEM when dynamic allocation failed.

Signed-off-by: zhaimingbing <zhaimingbing@cmss.chinamobile.com>
---
 tools/perf/util/scripting-engines/trace-event-perl.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/perf/util/scripting-engines/trace-event-perl.c b/tools/perf/util/scripting-engines/trace-event-perl.c
index 603091317..b072ac5d3 100644
--- a/tools/perf/util/scripting-engines/trace-event-perl.c
+++ b/tools/perf/util/scripting-engines/trace-event-perl.c
@@ -490,6 +490,9 @@ static int perl_start_script(const char *script, int argc, const char **argv,
 	scripting_context->session = session;
 
 	command_line = malloc((argc + 2) * sizeof(const char *));
+	if (!command_line)
+		return -ENOMEM;
+
 	command_line[0] = "";
 	command_line[1] = script;
 	for (i = 2; i < argc + 2; i++)
-- 
2.33.0




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

* Re: [PATCH] perf script perl: Fail check on dynamic allocation
  2023-11-20 11:23 [PATCH] perf script perl: Fail check on dynamic allocation zhaimingbing
@ 2023-11-21  0:30 ` Ian Rogers
  2023-11-21 17:23   ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 3+ messages in thread
From: Ian Rogers @ 2023-11-21  0:30 UTC (permalink / raw)
  To: zhaimingbing
  Cc: Namhyung Kim, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo, Mark Rutland, Alexander Shishkin,
	Jiri Olsa, Adrian Hunter, Sean Christopherson, Li Dong,
	linux-perf-users, linux-kernel

On Mon, Nov 20, 2023 at 3:24 AM zhaimingbing
<zhaimingbing@cmss.chinamobile.com> wrote:
>
> Return ENOMEM when dynamic allocation failed.
>
> Signed-off-by: zhaimingbing <zhaimingbing@cmss.chinamobile.com>

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

Thanks,
Ian

> ---
>  tools/perf/util/scripting-engines/trace-event-perl.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/tools/perf/util/scripting-engines/trace-event-perl.c b/tools/perf/util/scripting-engines/trace-event-perl.c
> index 603091317..b072ac5d3 100644
> --- a/tools/perf/util/scripting-engines/trace-event-perl.c
> +++ b/tools/perf/util/scripting-engines/trace-event-perl.c
> @@ -490,6 +490,9 @@ static int perl_start_script(const char *script, int argc, const char **argv,
>         scripting_context->session = session;
>
>         command_line = malloc((argc + 2) * sizeof(const char *));
> +       if (!command_line)
> +               return -ENOMEM;
> +
>         command_line[0] = "";
>         command_line[1] = script;
>         for (i = 2; i < argc + 2; i++)
> --
> 2.33.0
>
>
>
>

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

* Re: [PATCH] perf script perl: Fail check on dynamic allocation
  2023-11-21  0:30 ` Ian Rogers
@ 2023-11-21 17:23   ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2023-11-21 17:23 UTC (permalink / raw)
  To: Ian Rogers
  Cc: zhaimingbing, Namhyung Kim, Peter Zijlstra, Ingo Molnar,
	Mark Rutland, Alexander Shishkin, Jiri Olsa, Adrian Hunter,
	Sean Christopherson, Li Dong, linux-perf-users, linux-kernel

Em Mon, Nov 20, 2023 at 04:30:28PM -0800, Ian Rogers escreveu:
> On Mon, Nov 20, 2023 at 3:24 AM zhaimingbing
> <zhaimingbing@cmss.chinamobile.com> wrote:
> >
> > Return ENOMEM when dynamic allocation failed.
> >
> > Signed-off-by: zhaimingbing <zhaimingbing@cmss.chinamobile.com>
> 
> Reviewed-by: Ian Rogers <irogers@google.com>

Thanks, applied to perf-tools-next.

- Arnaldo

 
> Thanks,
> Ian
> 
> > ---
> >  tools/perf/util/scripting-engines/trace-event-perl.c | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/tools/perf/util/scripting-engines/trace-event-perl.c b/tools/perf/util/scripting-engines/trace-event-perl.c
> > index 603091317..b072ac5d3 100644
> > --- a/tools/perf/util/scripting-engines/trace-event-perl.c
> > +++ b/tools/perf/util/scripting-engines/trace-event-perl.c
> > @@ -490,6 +490,9 @@ static int perl_start_script(const char *script, int argc, const char **argv,
> >         scripting_context->session = session;
> >
> >         command_line = malloc((argc + 2) * sizeof(const char *));
> > +       if (!command_line)
> > +               return -ENOMEM;
> > +
> >         command_line[0] = "";
> >         command_line[1] = script;
> >         for (i = 2; i < argc + 2; i++)
> > --
> > 2.33.0
> >
> >
> >
> >

-- 

- Arnaldo

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

end of thread, other threads:[~2023-11-21 17:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-20 11:23 [PATCH] perf script perl: Fail check on dynamic allocation zhaimingbing
2023-11-21  0:30 ` Ian Rogers
2023-11-21 17:23   ` Arnaldo Carvalho de Melo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.