tracing: Add build bug if we have more trace_flags than bits

Add a enum that denotes the last bit of the trace_flags and have a
BUILD_BUG_ON(last_bit > 32).

If we add more bits than we have in trace_flags, the kernel wont build.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
This commit is contained in:
Steven Rostedt (Red Hat)
2015-09-29 18:13:33 -04:00
committed by Steven Rostedt
parent 41d9c0becc
commit b5e87c0581
2 changed files with 11 additions and 1 deletions
+6
View File
@@ -7046,6 +7046,12 @@ __init static int tracer_alloc_buffers(void)
int ring_buf_size;
int ret = -ENOMEM;
/*
* Make sure we don't accidently add more trace options
* than we have bits for.
*/
BUILD_BUG_ON(TRACE_ITER_LAST_BIT > 32);
if (!alloc_cpumask_var(&tracing_buffer_mask, GFP_KERNEL))
goto out;