From: Sven Eckelmann <sven@narfation.org>
To: LKML <linux-kernel@vger.kernel.org>,
Steven Rostedt <rostedt@goodmis.org>
Cc: Ingo Molnar <mingo@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Marek Lindner <mareklindner@neomailbox.ch>,
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
Subject: Re: [PATCH v2] batman-adv: tracing: Use the new __vstring() helper
Date: Mon, 25 Jul 2022 09:33:56 +0200 [thread overview]
Message-ID: <3133019.BU9PzZYyX2@ripper> (raw)
In-Reply-To: <20220724191650.236b1355@rorschach.local.home>
[-- Attachment #1: Type: text/plain, Size: 1763 bytes --]
On Monday, 25 July 2022 01:16:50 CEST Steven Rostedt wrote:
> 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.
Acked-by: Sven Eckelmann <sven@narfation.org>
(and sorry for taking such a long time to respond to the v1 version of the
patch).
> ---
> Changes since v1: https://lkml.kernel.org/r/20220705224751.080390002@goodmis.org
>
> - Removed no longer used BATADV_MAX_MSG_LEN
>
> 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(
>
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: Sven Eckelmann <sven@narfation.org>
To: LKML <linux-kernel@vger.kernel.org>,
Steven Rostedt <rostedt@goodmis.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
Subject: Re: [PATCH v2] batman-adv: tracing: Use the new __vstring() helper
Date: Mon, 25 Jul 2022 09:33:56 +0200 [thread overview]
Message-ID: <3133019.BU9PzZYyX2@ripper> (raw)
In-Reply-To: <20220724191650.236b1355@rorschach.local.home>
[-- Attachment #1: Type: text/plain, Size: 1763 bytes --]
On Monday, 25 July 2022 01:16:50 CEST Steven Rostedt wrote:
> 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.
Acked-by: Sven Eckelmann <sven@narfation.org>
(and sorry for taking such a long time to respond to the v1 version of the
patch).
> ---
> Changes since v1: https://lkml.kernel.org/r/20220705224751.080390002@goodmis.org
>
> - Removed no longer used BATADV_MAX_MSG_LEN
>
> 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(
>
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2022-07-25 7:33 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-24 23:16 [PATCH v2] batman-adv: tracing: Use the new __vstring() helper Steven Rostedt
2022-07-25 7:33 ` Sven Eckelmann [this message]
2022-07-25 7:33 ` Sven Eckelmann
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=3133019.BU9PzZYyX2@ripper \
--to=sven@narfation.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=rostedt@goodmis.org \
/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.