Преглед на файлове

tracing: Correctly expand len expressions from __dynamic_array macro

This fixes expansion of the len argument in __dynamic_array macros.
The previous code from commit 7d536cb3f would not fully evaluate the
expression before multiplying its result by the size of the type.

This went unnoticed because the length stored in the high 16 bits of the
offset (which is the one that was broken here) is only used by
filter_pred_strloc which only acts on strings for which the size of the
type is 1.

Link: http://lkml.kernel.org/r/1393651938-16418-2-git-send-email-filbranden@google.com

Signed-off-by: Filipe Brandenburger <filbranden@google.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Filipe Brandenburger преди 11 години
родител
ревизия
5859fa1a14
променени са 1 файла, в които са добавени 1 реда и са изтрити 1 реда
  1. 1 1
      include/trace/ftrace.h

+ 1 - 1
include/trace/ftrace.h

@@ -363,7 +363,7 @@ ftrace_define_fields_##call(struct ftrace_event_call *event_call)	\
 #define __dynamic_array(type, item, len)				\
 #define __dynamic_array(type, item, len)				\
 	__data_offsets->item = __data_size +				\
 	__data_offsets->item = __data_size +				\
 			       offsetof(typeof(*entry), __data);	\
 			       offsetof(typeof(*entry), __data);	\
-	__data_offsets->item |= (len * sizeof(type)) << 16;		\
+	__data_offsets->item |= ((len) * sizeof(type)) << 16;		\
 	__data_size += (len) * sizeof(type);
 	__data_size += (len) * sizeof(type);
 
 
 #undef __string
 #undef __string