Skip to content

Commit 51270d5

Browse files
rostedtdavem330
authored andcommitted
tracing/net_sched: Fix tracepoints that save qdisc_dev() as a string
I'm updating __assign_str() and will be removing the second parameter. To make sure that it does not break anything, I make sure that it matches the __string() field, as that is where the string is actually going to be saved in. To make sure there's nothing that breaks, I added a WARN_ON() to make sure that what was used in __string() is the same that is used in __assign_str(). In doing this change, an error was triggered as __assign_str() now expects the string passed in to be a char * value. I instead had the following warning: include/trace/events/qdisc.h: In function ‘trace_event_raw_event_qdisc_reset’: include/trace/events/qdisc.h:91:35: error: passing argument 1 of 'strcmp' from incompatible pointer type [-Werror=incompatible-pointer-types] 91 | __assign_str(dev, qdisc_dev(q)); That's because the qdisc_enqueue() and qdisc_reset() pass in qdisc_dev(q) to __assign_str() and to __string(). But that function returns a pointer to struct net_device and not a string. It appears that these events are just saving the pointer as a string and then reading it as a string as well. Use qdisc_dev(q)->name to save the device instead. Fixes: a34dac0 ("net_sched: add tracepoints for qdisc_reset() and qdisc_destroy()") Signed-off-by: Steven Rostedt (Google) <[email protected]> Reviewed-by: Jamal Hadi Salim <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 1c61728 commit 51270d5

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

include/trace/events/qdisc.h

+10-10
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,14 @@ TRACE_EVENT(qdisc_reset,
8181
TP_ARGS(q),
8282

8383
TP_STRUCT__entry(
84-
__string( dev, qdisc_dev(q) )
85-
__string( kind, q->ops->id )
86-
__field( u32, parent )
87-
__field( u32, handle )
84+
__string( dev, qdisc_dev(q)->name )
85+
__string( kind, q->ops->id )
86+
__field( u32, parent )
87+
__field( u32, handle )
8888
),
8989

9090
TP_fast_assign(
91-
__assign_str(dev, qdisc_dev(q));
91+
__assign_str(dev, qdisc_dev(q)->name);
9292
__assign_str(kind, q->ops->id);
9393
__entry->parent = q->parent;
9494
__entry->handle = q->handle;
@@ -106,14 +106,14 @@ TRACE_EVENT(qdisc_destroy,
106106
TP_ARGS(q),
107107

108108
TP_STRUCT__entry(
109-
__string( dev, qdisc_dev(q) )
110-
__string( kind, q->ops->id )
111-
__field( u32, parent )
112-
__field( u32, handle )
109+
__string( dev, qdisc_dev(q)->name )
110+
__string( kind, q->ops->id )
111+
__field( u32, parent )
112+
__field( u32, handle )
113113
),
114114

115115
TP_fast_assign(
116-
__assign_str(dev, qdisc_dev(q));
116+
__assign_str(dev, qdisc_dev(q)->name);
117117
__assign_str(kind, q->ops->id);
118118
__entry->parent = q->parent;
119119
__entry->handle = q->handle;

0 commit comments

Comments
 (0)