Skip to content


Subversion checkout URL

You can clone with
Download ZIP

tracing: Fix sample output of dynamic arrays

He Kuang noticed that the trace event samples for arrays was broken:

"The output result of trace_foo_bar event in traceevent samples is
 wrong. This problem can be reproduced as following:

  (Build kernel with SAMPLE_TRACE_EVENTS=m)

  $ insmod trace-events-sample.ko

  $ echo 1 > /sys/kernel/debug/tracing/events/sample-trace/foo_bar/enable

  $ cat /sys/kernel/debug/tracing/trace

  event-sample-980 [000] ....  43.649559: foo_bar: foo hello 21 0x15
  BIT1|BIT3|0x10 {0x1,0x6f6f6e53,0xff007970,0xffffffff} Snoopy
                 The array length is not right, should be {0x1}.

  event-sample-980 [000] ....  44.653827: foo_bar: foo hello 22 0x16
                 The array length is not right, should be {0x1,0x2}.
  Gandalf (ffffffff,ffffffff)"

This was caused by an update to have __print_array()'s second parameter
be the count of items in the array and not the size of the array.

As there is already users of __print_array(), it can not change. But
the sample code can and we can also improve on the documentation about
__print_array() and __get_dynamic_array_len().


Fixes: ac01ce1 ("tracing: Make ftrace_print_array_seq compute buf_len")
Reported-by: He Kuang <>
Signed-off-by: Steven Rostedt <>
latest commit d6726c8145
@rostedt rostedt authored
Something went wrong with that request. Please try again.