[PATCH] tracing: Report TP_printk double dereference with pr_warn()

David Carlier <[email protected]>
Newsgroups org.kernel.vger.linux-kernel,org.kernel.vger.linux-trace-kernel
Message-ID <[email protected]>
test_double_dereference() uses WARN_ONCE(), which is per-call-site. Only
the first offending event in the kernel is ever reported, and the tree
still has six: ice_{rx,tx}_dim_template, two hfi1 txq events, mtu3_ep and
edma_log_io. Whichever registers first hides the rest, and it taints the
kernel for what is a source-level mistake.

Use pr_warn() instead, matching the "TRACE EVENT ERROR:" report that
handle_dereference_arg() already emits for the same class of problem.
All offenders are now listed on one boot.

Fixes: b5cc230af5e5 ("tracing: Warn when an event dereferences a pointer in TP_printk()")
Signed-off-by: David Carlier <[email protected]>
---
 kernel/trace/trace_events.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
index a8590d2394e3..53f32752edc0 100644
--- a/kernel/trace/trace_events.c
+++ b/kernel/trace/trace_events.c
@@ -415,8 +415,8 @@ static void test_double_dereference(const char *str, int len,
 		ptr += 5;
 		for (; ptr < end; ptr++) {
 			if (ptr[0] == '-' && ptr[1] == '>') {
-				WARN_ONCE(1, "Event %s has double dereference in TP_printk: %.*s\n",
-					  trace_event_name(call), len, str);
+				pr_warn("TRACE EVENT ERROR: Event %s has double dereference in TP_printk: %.*s\n",
+					trace_event_name(call), len, str);
 				return;
 			}
 			if (!isalnum(*ptr) && *ptr != '_')
-- 
2.55.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.