Thread (21 messages) 21 messages, 2 authors, 2012-09-03

[RFC v2 09/15] scotest: Fix compilation errors due to unaligned memory access

flat view
STALE5168d SUPERSEDED

From: Szymon Janc <hidden>
Date: 2012-08-31 12:40:05
Subsystem: the rest · Maintainer: Linus Torvalds

Status: Superseded by v4 (posted 2012-09-04). [go to v4]

Revision v2 (3 revisions archived).

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

  CC     test/scotest.o
test/scotest.c: In function send_mode:
test/scotest.c:272:4: error: cast increases required alignment of
	target type [-Werror=cast-align]
test/scotest.c:273:4: error: cast increases required alignment of
	target type [-Werror=cast-align]
cc1: all warnings being treated as errors
make[1]: *** [test/scotest.o] Error 1
make: *** [all] Error 2

---
 test/scotest.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/test/scotest.c b/test/scotest.c
index 17bd8a6..de65edf 100644
--- a/test/scotest.c
+++ b/test/scotest.c
@@ -269,8 +269,9 @@ static void send_mode(char *svr)
 
 	seq = 0;
 	while (1) {
-		*(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, so.mtu, 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