Skip to content

Commit 64dc7f6

Browse files
mhiramatrostedt
authored andcommitted
tracing/boot: Show correct histogram error command
Since trigger_process_regex() modifies given trigger actions while parsing, the error message couldn't show what command was passed to the trigger_process_regex() when it returns an error. To fix that, show the backed up trigger action command instead of parsed buffer. Link: https://lkml.kernel.org/r/162856126413.203126.9465564928450701424.stgit@devnote2 Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
1 parent 17abd7c commit 64dc7f6

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

‎kernel/trace/trace_boot.c‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -422,22 +422,28 @@ trace_boot_init_histograms(struct trace_event_file *file,
422422
{
423423
struct xbc_node *node;
424424
const char *p;
425+
char *tmp;
425426

426427
xbc_node_for_each_subkey(hnode, node) {
427428
p = xbc_node_get_data(node);
428429
if (!isdigit(p[0]))
429430
continue;
430431
/* All digit started node should be instances. */
431432
if (trace_boot_compose_hist_cmd(node, buf, size) == 0) {
433+
tmp = kstrdup(buf, GFP_KERNEL);
432434
if (trigger_process_regex(file, buf) < 0)
433-
pr_err("Failed to apply hist trigger: %s\n", buf);
435+
pr_err("Failed to apply hist trigger: %s\n", tmp);
436+
kfree(tmp);
434437
}
435438
}
436439

437440
if (xbc_node_find_child(hnode, "keys")) {
438-
if (trace_boot_compose_hist_cmd(hnode, buf, size) == 0)
441+
if (trace_boot_compose_hist_cmd(hnode, buf, size) == 0) {
442+
tmp = kstrdup(buf, GFP_KERNEL);
439443
if (trigger_process_regex(file, buf) < 0)
440-
pr_err("Failed to apply hist trigger: %s\n", buf);
444+
pr_err("Failed to apply hist trigger: %s\n", tmp);
445+
kfree(tmp);
446+
}
441447
}
442448
}
443449
#else
@@ -488,7 +494,7 @@ trace_boot_init_one_event(struct trace_array *tr, struct xbc_node *gnode,
488494
if (strlcpy(buf, p, ARRAY_SIZE(buf)) >= ARRAY_SIZE(buf))
489495
pr_err("action string is too long: %s\n", p);
490496
else if (trigger_process_regex(file, buf) < 0)
491-
pr_err("Failed to apply an action: %s\n", buf);
497+
pr_err("Failed to apply an action: %s\n", p);
492498
}
493499
anode = xbc_node_find_child(enode, "hist");
494500
if (anode)

0 commit comments

Comments
 (0)