summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2009-03-03 19:53:07 +0100
committerSteven Rostedt <srostedt@redhat.com>2009-03-04 02:52:01 +0100
commite3d6bf0a0781a269f34250fd41e0d3dbfe540cf1 (patch)
tree71ae10423f61c30d8a6c9cb08779b2f1066c89ad
parentring-buffer: fix ring_buffer_read_page (diff)
downloadlinux-e3d6bf0a0781a269f34250fd41e0d3dbfe540cf1.tar.xz
linux-e3d6bf0a0781a269f34250fd41e0d3dbfe540cf1.zip
ring-buffer: replace sizeof of event header with offsetof
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>
-rw-r--r--kernel/trace/ring_buffer.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
index 2ad6bae95a3d..27cf834d8b4e 100644
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -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