ring-buffer: replace sizeof of event header with offsetof
authorSteven Rostedt <srostedt@redhat.com>
Tue, 3 Mar 2009 18:53:07 +0000 (13:53 -0500)
committerSteven Rostedt <srostedt@redhat.com>
Wed, 4 Mar 2009 01:52:01 +0000 (20:52 -0500)
Impact: fix to possible alignment problems on some archs.

Some arch compilers include an NULL char array in the sizeof field.
Since the ring_buffer_event type includes one of these, it is better
to use the "offsetof" instead, to avoid strange bugs on these archs.

Signed-off-by: Steven Rostedt <srostedt@redhat.com>
kernel/trace/ring_buffer.c

index 2ad6bae95a3d78ffaec7d2702f90b38d0048a8e2..27cf834d8b4e262107c356a5bef34dcf87a3d5f5 100644 (file)
@@ -132,7 +132,7 @@ void ring_buffer_normalize_time_stamp(int cpu, u64 *ts)
 }
 EXPORT_SYMBOL_GPL(ring_buffer_normalize_time_stamp);
 
-#define RB_EVNT_HDR_SIZE (sizeof(struct ring_buffer_event))
+#define RB_EVNT_HDR_SIZE (offsetof(struct ring_buffer_event, array))
 #define RB_ALIGNMENT           4U
 #define RB_MAX_SMALL_DATA      28