]> git.baikalelectronics.ru Git - kernel.git/commitdiff
tracing/iwlwifi: Use the new __vstring() helper
authorSteven Rostedt (Google) <rostedt@goodmis.org>
Tue, 5 Jul 2022 22:44:58 +0000 (18:44 -0400)
committerSteven Rostedt (Google) <rostedt@goodmis.org>
Fri, 15 Jul 2022 21:44:40 +0000 (17:44 -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/20220705224749.806599472@goodmis.org
Cc: Gregory Greenman <gregory.greenman@intel.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Kalle Valo <kvalo@kernel.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
Acked-by: Kalle Valo <kvalo@kernel.org>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
drivers/net/wireless/intel/iwlwifi/iwl-devtrace-msg.h

index 7dd70011fd1ef6da0eb0aed95191a31b67c57636..1d6c292cf545687c28aeaa49283cf9ff9af6e6f7 100644 (file)
@@ -18,12 +18,10 @@ DECLARE_EVENT_CLASS(iwlwifi_msg_event,
        TP_PROTO(struct va_format *vaf),
        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))
 );
@@ -55,14 +53,12 @@ TRACE_EVENT(iwlwifi_dbg,
        TP_STRUCT__entry(
                __field(u32, level)
                __string(function, function)
-               __dynamic_array(char, msg, MAX_MSG_LEN)
+               __vstring(msg, vaf->fmt, vaf->va)
        ),
        TP_fast_assign(
                __entry->level = level;
                __assign_str(function, function);
-               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))
 );