提交 3c20bd3a 编写于 作者: M Mathieu Desnoyers 提交者: Steven Rostedt (VMware)

tracing: Fix missing trace_boot_init_histograms kstrdup NULL checks

trace_boot_init_histograms misses NULL pointer checks for kstrdup
failure.

Link: https://lkml.kernel.org/r/20211015195550.22742-1-mathieu.desnoyers@efficios.com

Fixes: 64dc7f69 ("tracing/boot: Show correct histogram error command")
Acked-by: NMasami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: NMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: NSteven Rostedt (VMware) <rostedt@goodmis.org>
上级 aeafcb82
...@@ -430,6 +430,8 @@ trace_boot_init_histograms(struct trace_event_file *file, ...@@ -430,6 +430,8 @@ trace_boot_init_histograms(struct trace_event_file *file,
/* All digit started node should be instances. */ /* All digit started node should be instances. */
if (trace_boot_compose_hist_cmd(node, buf, size) == 0) { if (trace_boot_compose_hist_cmd(node, buf, size) == 0) {
tmp = kstrdup(buf, GFP_KERNEL); tmp = kstrdup(buf, GFP_KERNEL);
if (!tmp)
return;
if (trigger_process_regex(file, buf) < 0) if (trigger_process_regex(file, buf) < 0)
pr_err("Failed to apply hist trigger: %s\n", tmp); pr_err("Failed to apply hist trigger: %s\n", tmp);
kfree(tmp); kfree(tmp);
...@@ -439,6 +441,8 @@ trace_boot_init_histograms(struct trace_event_file *file, ...@@ -439,6 +441,8 @@ trace_boot_init_histograms(struct trace_event_file *file,
if (xbc_node_find_subkey(hnode, "keys")) { if (xbc_node_find_subkey(hnode, "keys")) {
if (trace_boot_compose_hist_cmd(hnode, buf, size) == 0) { if (trace_boot_compose_hist_cmd(hnode, buf, size) == 0) {
tmp = kstrdup(buf, GFP_KERNEL); tmp = kstrdup(buf, GFP_KERNEL);
if (!tmp)
return;
if (trigger_process_regex(file, buf) < 0) if (trigger_process_regex(file, buf) < 0)
pr_err("Failed to apply hist trigger: %s\n", tmp); pr_err("Failed to apply hist trigger: %s\n", tmp);
kfree(tmp); kfree(tmp);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册