Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tracing: Prevent further users of zero size static arrays in trace events

A zero size static array has special meaning in the ftrace infrastructure.
Trace events are for recording data in the trace buffers that is normally
difficult to obtain via probes or function tracing. There is no reason for
any trace event to declare a zero size static array.

If one does, BUILD_BUG_ON() will trigger and prevent the kernel from
compiling.

Reviewed-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>

+1
+1
include/trace/trace_events.h
··· 422 422 do { \ 423 423 char *type_str = #type"["__stringify(len)"]"; \ 424 424 BUILD_BUG_ON(len > MAX_FILTER_STR_VAL); \ 425 + BUILD_BUG_ON(len <= 0); \ 425 426 ret = trace_define_field(event_call, type_str, #item, \ 426 427 offsetof(typeof(field), item), \ 427 428 sizeof(field.item), \