diff options
author | Roy Li <rongqing.li@windriver.com> | 2014-05-22 14:37:18 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-05-27 16:11:54 +0100 |
commit | aba63bab07e26b748811fdc178a896b314d51cb1 (patch) | |
tree | 8091aaa7cd913c487d3baa029cf105155be9c899 /meta/recipes-kernel/lttng/babeltrace | |
parent | 359d2de19b2f6a51ac630486e63f8115ce305d59 (diff) | |
download | poky-aba63bab07e26b748811fdc178a896b314d51cb1.tar.gz |
babeltrace: fix alignment issue
Fix alignment issue in babeltrace
(From OE-Core rev: 862f14832d2d8a1917a5046d0299dbbbe6dc66da)
Signed-off-by: Roy Li <rongqing.li@windriver.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-kernel/lttng/babeltrace')
-rw-r--r-- | meta/recipes-kernel/lttng/babeltrace/Fix-Align-buffers-from-objstack_alloc-on-sizeof-void.patch | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/meta/recipes-kernel/lttng/babeltrace/Fix-Align-buffers-from-objstack_alloc-on-sizeof-void.patch b/meta/recipes-kernel/lttng/babeltrace/Fix-Align-buffers-from-objstack_alloc-on-sizeof-void.patch new file mode 100644 index 0000000000..8e81d2d781 --- /dev/null +++ b/meta/recipes-kernel/lttng/babeltrace/Fix-Align-buffers-from-objstack_alloc-on-sizeof-void.patch | |||
@@ -0,0 +1,54 @@ | |||
1 | From cae67efbd9ddf2cee6bbefec076dc8933ababc43 Mon Sep 17 00:00:00 2001 | ||
2 | From: =?UTF-8?q?Fredrik=20Markstr=C3=B6m?= <fredrik.markstrom@gmail.com> | ||
3 | Date: Fri, 16 May 2014 10:10:38 +0800 | ||
4 | Subject: [PATCH] Fix: Align buffers from objstack_alloc on sizeof(void *) | ||
5 | MIME-Version: 1.0 | ||
6 | Content-Type: text/plain; charset=UTF-8 | ||
7 | Content-Transfer-Encoding: 8bit | ||
8 | |||
9 | Upstream-Status: Backport | ||
10 | |||
11 | The buffers from objstack_alloc will store pointers, so they must | ||
12 | be aligned on a pointer's size, or else it will cause issues on the | ||
13 | CPUs which do not support unaligned addresses access. | ||
14 | |||
15 | Signed-off-by: Fredrik Markstrom <fredrik.markstrom@gmail.com> | ||
16 | Signed-off-by: Roy Li <rongqing.li@windriver.com> | ||
17 | Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com> | ||
18 | --- | ||
19 | formats/ctf/metadata/objstack.c | 5 ++++- | ||
20 | 1 file changed, 4 insertions(+), 1 deletion(-) | ||
21 | |||
22 | diff --git a/formats/ctf/metadata/objstack.c b/formats/ctf/metadata/objstack.c | ||
23 | index 9e264a4..14d9252 100644 | ||
24 | --- a/formats/ctf/metadata/objstack.c | ||
25 | +++ b/formats/ctf/metadata/objstack.c | ||
26 | @@ -27,6 +27,7 @@ | ||
27 | #include <stdlib.h> | ||
28 | #include <babeltrace/list.h> | ||
29 | #include <babeltrace/babeltrace-internal.h> | ||
30 | +#include <babeltrace/align.h> | ||
31 | |||
32 | #define OBJSTACK_INIT_LEN 128 | ||
33 | #define OBJSTACK_POISON 0xcc | ||
34 | @@ -39,7 +40,7 @@ struct objstack_node { | ||
35 | struct bt_list_head node; | ||
36 | size_t len; | ||
37 | size_t used_len; | ||
38 | - char data[]; | ||
39 | + char __attribute__ ((aligned (sizeof(void *)))) data[]; | ||
40 | }; | ||
41 | |||
42 | BT_HIDDEN | ||
43 | @@ -118,6 +119,8 @@ void *objstack_alloc(struct objstack *objstack, size_t len) | ||
44 | struct objstack_node *last_node; | ||
45 | void *p; | ||
46 | |||
47 | + len = ALIGN(len, sizeof(void *)); | ||
48 | + | ||
49 | /* Get last node */ | ||
50 | last_node = bt_list_entry(objstack->head.prev, | ||
51 | struct objstack_node, node); | ||
52 | -- | ||
53 | 1.7.10.4 | ||
54 | |||