From: Steven Rostedt <rostedt@goodmis.org>
To: LKML <linux-kernel@vger.kernel.org>
Cc: David Ahern <dsahern@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
netdev@vger.kernel.org
Subject: [PATCH] tracing/ipv4/ipv6: Give size to name field in fib*_lookup_table event
Date: Sun, 3 Jul 2022 10:23:59 -0400 [thread overview]
Message-ID: <20220703102359.30f12e39@rorschach.local.home> (raw)
From: "Steven Rostedt (Google)" <rostedt@goodmis.org>
The fib_lookup_table and fib6_lookup_table events declare name as a
dynamic_array, but also give it a fixed size, which defeats the purpose of
the dynamic array, especially since the dynamic array also includes meta
data in the event to specify its size.
Considering that the intent was to only reserve the size needed for the
name and not a fixed size, convert the size part of the __dynamic_array()
field to contain the necessary code to determine the size needed to save
the name.
Alternatively, if the intent was to use a fixed size, then it should be
converted into __array() of type char, which will remove the meta data in
the event that stores the size.
Cc: David Ahern <dsahern@gmail.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
include/trace/events/fib.h | 2 +-
include/trace/events/fib6.h | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/include/trace/events/fib.h b/include/trace/events/fib.h
index 6f2a4dc35e37..76f925f5519a 100644
--- a/include/trace/events/fib.h
+++ b/include/trace/events/fib.h
@@ -32,7 +32,7 @@ TRACE_EVENT(fib_table_lookup,
__array( __u8, gw6, 16 )
__field( u16, sport )
__field( u16, dport )
- __dynamic_array(char, name, IFNAMSIZ )
+ __dynamic_array(char, name, nhc && nhc->nhc_dev ? strlen(nhc->nhc_dev->name) + 1 : sizeof("-") )
),
TP_fast_assign(
diff --git a/include/trace/events/fib6.h b/include/trace/events/fib6.h
index c6abdcc77c12..d3aee58e58fd 100644
--- a/include/trace/events/fib6.h
+++ b/include/trace/events/fib6.h
@@ -31,7 +31,8 @@ TRACE_EVENT(fib6_table_lookup,
__field( u16, dport )
__field( u8, proto )
__field( u8, rt_type )
- __dynamic_array( char, name, IFNAMSIZ )
+ __dynamic_array( char, name, res->nh && res->nh->fib_nh_dev ?
+ strlen(res->nh->fib_nh_dev->name) + 1 : sizeof("-") )
__array( __u8, gw, 16 )
),
--
2.35.1
next reply other threads:[~2022-07-03 14:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-03 14:23 Steven Rostedt [this message]
2022-07-03 19:03 ` [PATCH] tracing/ipv4/ipv6: Give size to name field in fib*_lookup_table event David Ahern
2022-07-03 23:16 ` 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=20220703102359.30f12e39@rorschach.local.home \
--to=rostedt@goodmis.org \
--cc=davem@davemloft.net \
--cc=dsahern@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox