[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20211026172743.be436b228057c26fd73d0649@kernel.org>
Date: Tue, 26 Oct 2021 17:27:43 +0900
From: Masami Hiramatsu <mhiramat@...nel.org>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
linux-kernel@...r.kernel.org,
Masami Hiramatsu <mhiramat@...nel.org>
Subject: Re: [PATCH] tracing: Fix missing trace_boot_init_histograms kstrdup
NULL checks
On Mon, 25 Oct 2021 23:10:17 -0400
Steven Rostedt <rostedt@...dmis.org> wrote:
> On Fri, 15 Oct 2021 15:55:50 -0400
> Mathieu Desnoyers <mathieu.desnoyers@...icios.com> wrote:
>
> > trace_boot_init_histograms misses NULL pointer checks for kstrdup
> > failure.
> >
> > Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
> > Cc: Steven Rostedt <rostedt@...dmis.org>
>
> Masami,
>
> Can you ack this?
Yes, thanks for reporting this!
Acked-by: Masami Hiramatsu <mhiramat@...nel.org>
Thank you!
>
> -- Steve
>
> > ---
> > kernel/trace/trace_boot.c | 4 ++++
> > 1 file changed, 4 insertions(+)
> >
> > diff --git a/kernel/trace/trace_boot.c b/kernel/trace/trace_boot.c
> > index 8d252f63cd78..0580287d7a0d 100644
> > --- a/kernel/trace/trace_boot.c
> > +++ b/kernel/trace/trace_boot.c
> > @@ -430,6 +430,8 @@ trace_boot_init_histograms(struct trace_event_file *file,
> > /* All digit started node should be instances. */
> > if (trace_boot_compose_hist_cmd(node, buf, size) == 0) {
> > tmp = kstrdup(buf, GFP_KERNEL);
> > + if (!tmp)
> > + return;
> > if (trigger_process_regex(file, buf) < 0)
> > pr_err("Failed to apply hist trigger: %s\n", tmp);
> > kfree(tmp);
> > @@ -439,6 +441,8 @@ trace_boot_init_histograms(struct trace_event_file *file,
> > if (xbc_node_find_subkey(hnode, "keys")) {
> > if (trace_boot_compose_hist_cmd(hnode, buf, size) == 0) {
> > tmp = kstrdup(buf, GFP_KERNEL);
> > + if (!tmp)
> > + return;
> > if (trigger_process_regex(file, buf) < 0)
> > pr_err("Failed to apply hist trigger: %s\n", tmp);
> > kfree(tmp);
>
--
Masami Hiramatsu <mhiramat@...nel.org>
Powered by blists - more mailing lists