Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Masami Hiramatsu and committed by
Steven Rostedt (VMware)
64dc7f69 17abd7c3

+10 -4
+10 -4
kernel/trace/trace_boot.c
··· 422 422 { 423 423 struct xbc_node *node; 424 424 const char *p; 425 + char *tmp; 425 426 426 427 xbc_node_for_each_subkey(hnode, node) { 427 428 p = xbc_node_get_data(node); ··· 430 429 continue; 431 430 /* All digit started node should be instances. */ 432 431 if (trace_boot_compose_hist_cmd(node, buf, size) == 0) { 432 + tmp = kstrdup(buf, GFP_KERNEL); 433 433 if (trigger_process_regex(file, buf) < 0) 434 - pr_err("Failed to apply hist trigger: %s\n", buf); 434 + pr_err("Failed to apply hist trigger: %s\n", tmp); 435 + kfree(tmp); 435 436 } 436 437 } 437 438 438 439 if (xbc_node_find_child(hnode, "keys")) { 439 - if (trace_boot_compose_hist_cmd(hnode, buf, size) == 0) 440 + if (trace_boot_compose_hist_cmd(hnode, buf, size) == 0) { 441 + tmp = kstrdup(buf, GFP_KERNEL); 440 442 if (trigger_process_regex(file, buf) < 0) 441 - pr_err("Failed to apply hist trigger: %s\n", buf); 443 + pr_err("Failed to apply hist trigger: %s\n", tmp); 444 + kfree(tmp); 445 + } 442 446 } 443 447 } 444 448 #else ··· 494 488 if (strlcpy(buf, p, ARRAY_SIZE(buf)) >= ARRAY_SIZE(buf)) 495 489 pr_err("action string is too long: %s\n", p); 496 490 else if (trigger_process_regex(file, buf) < 0) 497 - pr_err("Failed to apply an action: %s\n", buf); 491 + pr_err("Failed to apply an action: %s\n", p); 498 492 } 499 493 anode = xbc_node_find_child(enode, "hist"); 500 494 if (anode)