Thread (22 messages) 22 messages, 3 authors, 2012-09-05

[RFC v4 05/18] rctest: Fix compilation errors due to unaligned memory access

flat view
STALE5162d

From: Szymon Janc <hidden>
Date: 2012-09-04 14:41:24
Subsystem: the rest · Maintainer: Linus Torvalds

Revision v4 of 3 in this series.

Revisions (3)
  1. rfc [diff vs current]
  2. v2 [diff vs current]
  3. v4 current
This fix following build errors on ARM.

  CC     test/rctest.o
test/rctest.c: In function do_send:
test/rctest.c:539:4: error: cast increases required alignment of target
	type [-Werror=cast-align]
test/rctest.c:540:4: error: cast increases required alignment of target
	type [-Werror=cast-align]
cc1: all warnings being treated as errors
make[1]: *** [test/rctest.o] Error 1

---
 test/rctest.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/test/rctest.c b/test/rctest.c
index f82d2cc..2dd54de 100644
--- a/test/rctest.c
+++ b/test/rctest.c
@@ -536,8 +536,9 @@ static void do_send(int sk)
 
 	seq = 0;
 	while ((num_frames == -1) || (num_frames-- > 0)) {
-		*(uint32_t *) buf = htobl(seq);
-		*(uint16_t *) (buf + 4) = htobs(data_size);
+		bt_put_le32(seq, buf);
+		bt_put_le16(data_size, buf + 4);
+
 		seq++;
 
 		if (send(sk, buf, data_size, 0) <= 0) {
-- 
1.7.9.5
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help