Skip to content

Commit 4d9b7ed

Browse files
compudjgregkh
authored andcommitted
tracing: Fix missing trace_boot_init_histograms kstrdup NULL checks
[ Upstream commit 3c20bd3 ] 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: 64dc7f6 ("tracing/boot: Show correct histogram error command") Acked-by: Masami Hiramatsu <mhiramat@kernel.org> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent d3ec9c3 commit 4d9b7ed

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

‎kernel/trace/trace_boot.c‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,8 @@ trace_boot_init_histograms(struct trace_event_file *file,
430430
/* All digit started node should be instances. */
431431
if (trace_boot_compose_hist_cmd(node, buf, size) == 0) {
432432
tmp = kstrdup(buf, GFP_KERNEL);
433+
if (!tmp)
434+
return;
433435
if (trigger_process_regex(file, buf) < 0)
434436
pr_err("Failed to apply hist trigger: %s\n", tmp);
435437
kfree(tmp);
@@ -439,6 +441,8 @@ trace_boot_init_histograms(struct trace_event_file *file,
439441
if (xbc_node_find_subkey(hnode, "keys")) {
440442
if (trace_boot_compose_hist_cmd(hnode, buf, size) == 0) {
441443
tmp = kstrdup(buf, GFP_KERNEL);
444+
if (!tmp)
445+
return;
442446
if (trigger_process_regex(file, buf) < 0)
443447
pr_err("Failed to apply hist trigger: %s\n", tmp);
444448
kfree(tmp);

0 commit comments

Comments
 (0)