diff options
author | Masami Hiramatsu <mhiramat@redhat.com> | 2008-05-07 19:23:44 -0400 |
---|---|---|
committer | Masami Hiramatsu <mhiramat@redhat.com> | 2008-05-07 19:23:44 -0400 |
commit | 3e2a19a9f57fe40b872f5084c5c60ba1a45f087c (patch) | |
tree | 4f884eed6c907636a47167639fb4e405808fba51 | |
parent | 56d9a530202979fed9544131aa2e53bf2da0c7de (diff) | |
download | systemtap-steved-3e2a19a9f57fe40b872f5084c5c60ba1a45f087c.tar.gz systemtap-steved-3e2a19a9f57fe40b872f5084c5c60ba1a45f087c.tar.xz systemtap-steved-3e2a19a9f57fe40b872f5084c5c60ba1a45f087c.zip |
PR5648: Fix unaligned access warning in stp_print_flush on ia64
-rw-r--r-- | runtime/ChangeLog | 7 | ||||
-rw-r--r-- | runtime/print_new.c | 12 | ||||
-rw-r--r-- | runtime/print_old.c | 12 |
3 files changed, 21 insertions, 10 deletions
diff --git a/runtime/ChangeLog b/runtime/ChangeLog index 0a66a28b..f0f65215 100644 --- a/runtime/ChangeLog +++ b/runtime/ChangeLog @@ -1,6 +1,13 @@ 2008-05-06 Masami Hiramatsu <mhiramat@redhat.com> PR 5648 + * print_old.c (stp_print_flush): Fix unaligned access warning on + ia64. + * print_new.c (stp_print_flush): Ditto. + +2008-05-06 Masami Hiramatsu <mhiramat@redhat.com> + + PR 5648 * vsprintf.c (_stp_vsnprintf): Fix memcpy's endianess issue. 2008-05-05 Frank Ch. Eigler <fche@elastic.org> diff --git a/runtime/print_new.c b/runtime/print_new.c index 75bbd82b..07af2e33 100644 --- a/runtime/print_new.c +++ b/runtime/print_new.c @@ -40,11 +40,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 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 |