All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Marek Lindner <mareklindner@neomailbox.ch>,
	Simon Wunderlich <sw@simonwunderlich.de>,
	Antonio Quartulli <a@unstable.cc>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	b.a.t.m.a.n@lists.open-mesh.org, netdev@vger.kernel.org,
	Sven Eckelmann <sven@narfation.org>
Subject: [for-next][PATCH 02/21] batman-adv: tracing: Use the new __vstring() helper
Date: Sun, 31 Jul 2022 15:03:31 -0400	[thread overview]
Message-ID: <20220731190432.106094347@goodmis.org> (raw)
In-Reply-To: 20220731190329.641602282@goodmis.org

From: "Steven Rostedt (Google)" <rostedt@goodmis.org>

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>
---
 net/batman-adv/trace.h | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/net/batman-adv/trace.h b/net/batman-adv/trace.h
index d673ebdd0426..31c8f922651d 100644
--- a/net/batman-adv/trace.h
+++ b/net/batman-adv/trace.h
@@ -28,8 +28,6 @@
 
 #endif /* CONFIG_BATMAN_ADV_TRACING */
 
-#define BATADV_MAX_MSG_LEN	256
-
 TRACE_EVENT(batadv_dbg,
 
 	    TP_PROTO(struct batadv_priv *bat_priv,
@@ -40,16 +38,13 @@ TRACE_EVENT(batadv_dbg,
 	    TP_STRUCT__entry(
 		    __string(device, bat_priv->soft_iface->name)
 		    __string(driver, KBUILD_MODNAME)
-		    __dynamic_array(char, msg, BATADV_MAX_MSG_LEN)
+		    __vstring(msg, vaf->fmt, vaf->va)
 	    ),
 
 	    TP_fast_assign(
 		    __assign_str(device, bat_priv->soft_iface->name);
 		    __assign_str(driver, KBUILD_MODNAME);
-		    WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg),
-					   BATADV_MAX_MSG_LEN,
-					   vaf->fmt,
-					   *vaf->va) >= BATADV_MAX_MSG_LEN);
+		    __assign_vstr(msg, vaf->fmt, vaf->va);
 	    ),
 
 	    TP_printk(
-- 
2.35.1

  parent reply	other threads:[~2022-07-31 19:04 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-31 19:03 [for-next][PATCH 00/21] tracing: Updates for 5.20 Steven Rostedt
2022-07-31 19:03 ` [for-next][PATCH 01/21] USB: mtu3: tracing: Use the new __vstring() helper Steven Rostedt
2022-07-31 19:03   ` Steven Rostedt
2022-07-31 19:03 ` Steven Rostedt [this message]
2022-07-31 19:03 ` [for-next][PATCH 04/21] ftrace/x86: Add back ftrace_expected assignment Steven Rostedt
2022-07-31 19:03 ` [for-next][PATCH 05/21] rv: Add Runtime Verification (RV) interface Steven Rostedt
2022-07-31 19:03 ` [for-next][PATCH 06/21] rv: Add runtime reactors interface Steven Rostedt
2022-07-31 19:03 ` [for-next][PATCH 07/21] rv/include: Add helper functions for deterministic automata Steven Rostedt
2022-07-31 19:03 ` [for-next][PATCH 08/21] rv/include: Add deterministic automata monitor definition via C macros Steven Rostedt
2022-07-31 19:03 ` [for-next][PATCH 09/21] rv/include: Add instrumentation helper functions Steven Rostedt
2022-07-31 19:03 ` [for-next][PATCH 10/21] Documentation/rv: Add a basic documentation Steven Rostedt
2022-07-31 19:03 ` [for-next][PATCH 11/21] tools/rv: Add dot2c Steven Rostedt
2022-07-31 19:03 ` [for-next][PATCH 12/21] Documentation/rv: Add deterministic automaton documentation Steven Rostedt
2022-07-31 19:03 ` [for-next][PATCH 13/21] tools/rv: Add dot2k Steven Rostedt
2022-07-31 19:03 ` [for-next][PATCH 14/21] Documentation/rv: Add deterministic automata monitor synthesis documentation Steven Rostedt
2022-07-31 19:03 ` [for-next][PATCH 15/21] Documentation/rv: Add deterministic automata instrumentation documentation Steven Rostedt
2022-07-31 19:03 ` [for-next][PATCH 16/21] rv/monitor: Add the wip monitor skeleton created by dot2k Steven Rostedt
2022-07-31 19:03 ` [for-next][PATCH 17/21] rv/monitor: Add the wip monitor Steven Rostedt
2022-07-31 19:03 ` [for-next][PATCH 18/21] rv/monitor: Add the wwnr monitor Steven Rostedt
2022-07-31 19:03 ` [for-next][PATCH 19/21] rv/reactor: Add the printk reactor Steven Rostedt
2022-07-31 19:03 ` [for-next][PATCH 20/21] rv/reactor: Add the panic reactor Steven Rostedt
2022-07-31 19:03 ` [for-next][PATCH 21/21] tracing: Use a struct alignof to determine trace event field alignment Steven Rostedt
2022-08-01  7:46   ` David Laight
2022-08-01 21:08     ` Steven Rostedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220731190432.106094347@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=a@unstable.cc \
    --cc=akpm@linux-foundation.org \
    --cc=b.a.t.m.a.n@lists.open-mesh.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mareklindner@neomailbox.ch \
    --cc=mingo@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sven@narfation.org \
    --cc=sw@simonwunderlich.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.