[PATCH] neighbor: tracing: Have neigh_create event use __string()

From: Steven Rostedt
Date: Tue Jul 05 2022 - 18:37:49 EST


From: "Steven Rostedt (Google)" <rostedt@xxxxxxxxxxx>

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@xxxxxxxxx>
Cc: David S. Miller <davem@xxxxxxxxxxxxx>
Cc: netdev@xxxxxxxxxxxxxxx
Signed-off-by: Steven Rostedt (Google) <rostedt@xxxxxxxxxxx>
---

[ 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