batman-adv: tracing: Use the new __vstring() helper

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/20220724191650.236b1355@rorschach.local.home

Cc: Marek Lindner <mareklindner@neomailbox.ch>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Simon Wunderlich <sw@simonwunderlich.de>
Cc: Antonio Quartulli <a@unstable.cc>
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: b.a.t.m.a.n@lists.open-mesh.org
Cc: netdev@vger.kernel.org
Acked-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
This commit is contained in:
Steven Rostedt (Google) 2022-07-24 19:16:50 -04:00
Родитель 730dbb8dda
Коммит 9abc291812
1 изменённых файлов: 2 добавлений и 7 удалений

Просмотреть файл

@ -28,8 +28,6 @@
#endif /* CONFIG_BATMAN_ADV_TRACING */ #endif /* CONFIG_BATMAN_ADV_TRACING */
#define BATADV_MAX_MSG_LEN 256
TRACE_EVENT(batadv_dbg, TRACE_EVENT(batadv_dbg,
TP_PROTO(struct batadv_priv *bat_priv, TP_PROTO(struct batadv_priv *bat_priv,
@ -40,16 +38,13 @@ TRACE_EVENT(batadv_dbg,
TP_STRUCT__entry( TP_STRUCT__entry(
__string(device, bat_priv->soft_iface->name) __string(device, bat_priv->soft_iface->name)
__string(driver, KBUILD_MODNAME) __string(driver, KBUILD_MODNAME)
__dynamic_array(char, msg, BATADV_MAX_MSG_LEN) __vstring(msg, vaf->fmt, vaf->va)
), ),
TP_fast_assign( TP_fast_assign(
__assign_str(device, bat_priv->soft_iface->name); __assign_str(device, bat_priv->soft_iface->name);
__assign_str(driver, KBUILD_MODNAME); __assign_str(driver, KBUILD_MODNAME);
WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg), __assign_vstr(msg, vaf->fmt, vaf->va);
BATADV_MAX_MSG_LEN,
vaf->fmt,
*vaf->va) >= BATADV_MAX_MSG_LEN);
), ),
TP_printk( TP_printk(