mac80211: tracing: Use the new __vstring() helper
authorSteven Rostedt (Google) <rostedt@goodmis.org>
Tue, 5 Jul 2022 22:45:06 +0000 (18:45 -0400)
committerSteven Rostedt (Google) <rostedt@goodmis.org>
Sun, 24 Jul 2022 23:11:17 +0000 (19:11 -0400)
Instead of open coding a __dynamic_array() with a fixed length (which
defeats the purpose of the dynamic array in the first place). Use the new
__vstring() helper that will use a va_list and only write enough of the
string into the ring buffer that is needed.

Link: https://lkml.kernel.org/r/20220705224751.271015450@goodmis.org
Cc: Johannes Berg <johannes@sipsolutions.net>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: linux-wireless@vger.kernel.org
Cc: netdev@vger.kernel.org
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
net/mac80211/trace_msg.h

index 40141df09f255fac46043f67656e98e16adda5b9..c9dbe9aab7bdcadb9e8196bb7da3c27fe4dd5ac8 100644 (file)
@@ -24,13 +24,11 @@ DECLARE_EVENT_CLASS(mac80211_msg_event,
        TP_ARGS(vaf),
 
        TP_STRUCT__entry(
-               __dynamic_array(char, msg, MAX_MSG_LEN)
+               __vstring(msg, vaf->fmt, vaf->va)
        ),
 
        TP_fast_assign(
-               WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg),
-                                      MAX_MSG_LEN, vaf->fmt,
-                                      *vaf->va) >= MAX_MSG_LEN);
+               __assign_vstr(msg, vaf->fmt, vaf->va);
        ),
 
        TP_printk("%s", __get_str(msg))