linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] neighbor: tracing: Have neigh_create event use __string()
@ 2022-07-05 22:37 Steven Rostedt
  2022-07-06  1:43 ` David Ahern
  2022-07-08  0:21 ` Jakub Kicinski
  0 siblings, 2 replies; 5+ messages in thread
From: Steven Rostedt @ 2022-07-05 22:37 UTC (permalink / raw)
  To: LKML; +Cc: David Ahern, David S. Miller, netdev

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

The dev field of the neigh_create event uses __dynamic_array() with a
fixed size, which defeats the purpose of __dynamic_array(). Looking at the
logic, as it already uses __assign_str(), just use the same logic in
__string to create the size needed. It appears that because "dev" can be
NULL, it needs the check. But __string() can have the same checks as
__assign_str() so use them there too.

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>
---

[ This is simpler logic than the fib* events, so I figured just
  convert to __string() instead of a static __array() ]

 include/trace/events/neigh.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/trace/events/neigh.h b/include/trace/events/neigh.h
index 62bb17516713..5eaa1fa99171 100644
--- a/include/trace/events/neigh.h
+++ b/include/trace/events/neigh.h
@@ -30,7 +30,7 @@ TRACE_EVENT(neigh_create,
 
 	TP_STRUCT__entry(
 		__field(u32, family)
-		__dynamic_array(char,  dev,   IFNAMSIZ )
+		__string(dev, dev ? dev->name : "NULL")
 		__field(int, entries)
 		__field(u8, created)
 		__field(u8, gc_exempt)
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] neighbor: tracing: Have neigh_create event use __string()
  2022-07-05 22:37 [PATCH] neighbor: tracing: Have neigh_create event use __string() Steven Rostedt
@ 2022-07-06  1:43 ` David Ahern
  2022-07-08  0:21 ` Jakub Kicinski
  1 sibling, 0 replies; 5+ messages in thread
From: David Ahern @ 2022-07-06  1:43 UTC (permalink / raw)
  To: Steven Rostedt, LKML; +Cc: David S. Miller, netdev

On 7/5/22 4:37 PM, Steven Rostedt wrote:
> From: "Steven Rostedt (Google)" <rostedt@goodmis.org>
> 
> The dev field of the neigh_create event uses __dynamic_array() with a
> fixed size, which defeats the purpose of __dynamic_array(). Looking at the
> logic, as it already uses __assign_str(), just use the same logic in
> __string to create the size needed. It appears that because "dev" can be
> NULL, it needs the check. But __string() can have the same checks as
> __assign_str() so use them there too.
> 
> 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>
> ---
> 
> [ This is simpler logic than the fib* events, so I figured just
>   convert to __string() instead of a static __array() ]
> 

agreed.

Reviewed-by: David Ahern <dsahern@kernel.org>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] neighbor: tracing: Have neigh_create event use __string()
  2022-07-05 22:37 [PATCH] neighbor: tracing: Have neigh_create event use __string() Steven Rostedt
  2022-07-06  1:43 ` David Ahern
@ 2022-07-08  0:21 ` Jakub Kicinski
  2022-07-08  0:56   ` Steven Rostedt
  1 sibling, 1 reply; 5+ messages in thread
From: Jakub Kicinski @ 2022-07-08  0:21 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: LKML, David Ahern, David S. Miller, netdev

On Tue, 5 Jul 2022 18:37:41 -0400 Steven Rostedt wrote:
> From: "Steven Rostedt (Google)" <rostedt@goodmis.org>
> 
> The dev field of the neigh_create event uses __dynamic_array() with a
> fixed size, which defeats the purpose of __dynamic_array(). Looking at the
> logic, as it already uses __assign_str(), just use the same logic in
> __string to create the size needed. It appears that because "dev" can be
> NULL, it needs the check. But __string() can have the same checks as
> __assign_str() so use them there too.
> 
> 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>
> ---
> 
> [ This is simpler logic than the fib* events, so I figured just
>   convert to __string() instead of a static __array() ]

This one is also going via your tree?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] neighbor: tracing: Have neigh_create event use __string()
  2022-07-08  0:21 ` Jakub Kicinski
@ 2022-07-08  0:56   ` Steven Rostedt
  2022-07-08  1:04     ` Jakub Kicinski
  0 siblings, 1 reply; 5+ messages in thread
From: Steven Rostedt @ 2022-07-08  0:56 UTC (permalink / raw)
  To: Jakub Kicinski; +Cc: LKML, David Ahern, David S. Miller, netdev

On Thu, 7 Jul 2022 17:21:01 -0700
Jakub Kicinski <kuba@kernel.org> wrote:

> > 
> > [ This is simpler logic than the fib* events, so I figured just
> >   convert to __string() instead of a static __array() ]  
> 
> This one is also going via your tree?

Yep, I can pull it in too.

-- Steve

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] neighbor: tracing: Have neigh_create event use __string()
  2022-07-08  0:56   ` Steven Rostedt
@ 2022-07-08  1:04     ` Jakub Kicinski
  0 siblings, 0 replies; 5+ messages in thread
From: Jakub Kicinski @ 2022-07-08  1:04 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: LKML, David Ahern, David S. Miller, netdev

On Thu, 7 Jul 2022 20:56:22 -0400 Steven Rostedt wrote:
> > > [ This is simpler logic than the fib* events, so I figured just
> > >   convert to __string() instead of a static __array() ]    
> > 
> > This one is also going via your tree?  
> 
> Yep, I can pull it in too.

Acked-by: Jakub Kicinski <kuba@kernel.org>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-07-08  1:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-05 22:37 [PATCH] neighbor: tracing: Have neigh_create event use __string() Steven Rostedt
2022-07-06  1:43 ` David Ahern
2022-07-08  0:21 ` Jakub Kicinski
2022-07-08  0:56   ` Steven Rostedt
2022-07-08  1:04     ` Jakub Kicinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).