tracing/net_sched: Fix tracepoints that save qdisc_dev() as a string
authorSteven Rostedt (Google) <rostedt@goodmis.org>
Thu, 29 Feb 2024 19:34:44 +0000 (14:34 -0500)
committerDavid S. Miller <davem@davemloft.net>
Mon, 4 Mar 2024 09:35:54 +0000 (09:35 +0000)
commit51270d573a8d9dd5afdc7934de97d66c0e14b5fd
tree81321c1acf77dfcc1ffe0a3a3affb7e16248f4f9
parent1c61728be22c1cb49c1be88693e72d8c06b1c81e
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: a34dac0b90552 ("net_sched: add tracepoints for qdisc_reset() and qdisc_destroy()")
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Reviewed-by: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/trace/events/qdisc.h