summaryrefslogtreecommitdiffstats
path: root/runtime/print_old.c
diff options
context:
space:
mode:
authorMasami Hiramatsu <mhiramat@redhat.com>2008-05-07 19:23:44 -0400
committerMasami Hiramatsu <mhiramat@redhat.com>2008-05-07 19:23:44 -0400
commit3e2a19a9f57fe40b872f5084c5c60ba1a45f087c (patch)
tree4f884eed6c907636a47167639fb4e405808fba51 /runtime/print_old.c
parent56d9a530202979fed9544131aa2e53bf2da0c7de (diff)
downloadsystemtap-steved-3e2a19a9f57fe40b872f5084c5c60ba1a45f087c.tar.gz
systemtap-steved-3e2a19a9f57fe40b872f5084c5c60ba1a45f087c.tar.xz
systemtap-steved-3e2a19a9f57fe40b872f5084c5c60ba1a45f087c.zip
PR5648: Fix unaligned access warning in stp_print_flush on ia64
Diffstat (limited to 'runtime/print_old.c')
-rw-r--r--runtime/print_old.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/runtime/print_old.c b/runtime/print_old.c
index 5ee050b5..5c117e5f 100644
--- a/runtime/print_old.c
+++ b/runtime/print_old.c
@@ -35,11 +35,13 @@ void EXPORT_FN(stp_print_flush) (_stp_pbuf *pb)
else
atomic_inc (&_stp_transport_failures);
#else
- struct _stp_trace *t = relay_reserve(_stp_utt->rchan, sizeof(*t) + len);
- if (likely(t)) {
- t->sequence = _stp_seq_inc();
- t->pdu_len = len;
- memcpy((void *) t + sizeof(*t), pb->buf, len);
+ void *buf = relay_reserve(_stp_utt->rchan,
+ sizeof(struct _stp_trace) + len);
+ if (likely(buf)) {
+ struct _stp_trace t = { .sequence = _stp_seq_inc(),
+ .pdu_len = len};
+ memcpy(buf, &t, sizeof(t)); // prevent unaligned access
+ memcpy(buf + sizeof(t), pb->buf, len);
} else
atomic_inc (&_stp_transport_failures);
#endif