tracing: Fix missing trace_boot_init_histograms kstrdup NULL checks
Mathieu Desnoyers
reviewerPATCH 1/1 tracing: Fix missing trace_boot_init_histograms kstrdup NULL checks
trace_boot_init_histograms misses NULL pointer checks for kstrdup failure.
Signed-off-by Mathieu Desnoyers <[email protected]>
Cc Steven Rostedt <[email protected]>
--- kernel/trace/trace_boot.c | 4 ++++ 1 file changed, 4 insertions(+)
kernel/trace/trace_boot.c +4 -0
@@ -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);
Signature · 1 line
2.20.1
Steven Rostedt
maintainerQuoted 5 lines · On Fri, 15 Oct 2021 15:55:50 -0400 Mathieu Desnoyers…
trace_boot_init_histogramsmisses NULL pointer checks for kstrdup failure.Signed-off-by Mathieu Desnoyers <[email protected]>Cc Steven Rostedt <[email protected]>
Masami,
Can you ack this?
-- Steve
Quoted 26 lines
--- kernel/trace/trace_boot.c | 4 ++++ 1 file changed, 4 insertions(+)kernel/trace/trace_boot.c +4
-0@@ -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);
Quoted 6 lines · On Mon, 25 Oct 2021 23:10:17 -0400 Steven Rostedt <[email protected]> wrote:
Quoted 3 lines · On Fri, 15 Oct 2021 15:55:50 -0400 Mathieu Desnoyers…
trace_boot_init_histogramsmisses NULL pointer checks for kstrdup failure.
Quoted 6 lines
Quoted 2 lines
Signed-off-by Mathieu Desnoyers <[email protected]>Cc Steven Rostedt <[email protected]>Masami,
Can you ack this?
Yes, thanks for reporting this!
Acked-by Masami Hiramatsu <[email protected]>
Thank you!
Quoted 30 lines
-- Steve
Quoted 26 lines
--- kernel/trace/trace_boot.c | 4 ++++ 1 file changed, 4 insertions(+)kernel/trace/trace_boot.c +4
-0@@ -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);
Signature · 1 line
Masami Hiramatsu <[email protected]>