From: Fredrik Markström <[email protected]> The buffers from objstack_alloc will store the pointer, so it must be aligned on pointer, or else it will cause issue on the cpu which does not support unaligned addresses access
Signed-off-by: Fredrik Markstrom <[email protected]> Signed-off-by: Roy Li <[email protected]> --- formats/ctf/metadata/objstack.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/formats/ctf/metadata/objstack.c b/formats/ctf/metadata/objstack.c index 9e264a4..0e7d04e 100644 --- a/formats/ctf/metadata/objstack.c +++ b/formats/ctf/metadata/objstack.c @@ -39,7 +39,7 @@ struct objstack_node { struct bt_list_head node; size_t len; size_t used_len; - char data[]; + char __attribute__ ((aligned (sizeof(void *)))) data[]; }; BT_HIDDEN @@ -118,6 +118,8 @@ void *objstack_alloc(struct objstack *objstack, size_t len) struct objstack_node *last_node; void *p; + len = ALIGN(len, sizeof(void *)); + /* Get last node */ last_node = bt_list_entry(objstack->head.prev, struct objstack_node, node); -- 1.7.10.4 _______________________________________________ lttng-dev mailing list [email protected] http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
