[RFC 06/15] l2test: Fix compilation errors due to unaligned memory access

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This fix following build errors on ARM.

  CC     test/l2test.o
test/l2test.c: In function recv_mode:
test/l2test.c:826:9: error: cast increases required alignment of target
	type [-Werror=cast-align]
test/l2test.c:834:8: error: cast increases required alignment of target
	type [-Werror=cast-align]
test/l2test.c: In function do_send:
test/l2test.c:893:4: error: cast increases required alignment of target
	type [-Werror=cast-align]
test/l2test.c:894:4: error: cast increases required alignment of target
	type [-Werror=cast-align]
cc1: all warnings being treated as errors
make[1]: *** [test/l2test.o] Error 1

Change-Id: If23f312fcb10d66f74891f6a8bffcac737ae5eda
---
 test/l2test.c |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/test/l2test.c b/test/l2test.c
index d31be10..7645681 100644
--- a/test/l2test.c
+++ b/test/l2test.c
@@ -823,7 +823,7 @@ static void recv_mode(int sk)
 			}
 
 			/* Check sequence */
-			sq = btohl(*(uint32_t *) buf);
+			sq = bt_get_le32(buf);
 			if (seq != sq) {
 				syslog(LOG_INFO, "seq missmatch: %d -> %d", seq, sq);
 				seq = sq;
@@ -831,7 +831,7 @@ static void recv_mode(int sk)
 			seq++;
 
 			/* Check length */
-			l = btohs(*(uint16_t *) (buf + 4));
+			l = bt_get_le16(buf + 4);
 			if (len != l) {
 				syslog(LOG_INFO, "size missmatch: %d -> %d", len, l);
 				continue;
@@ -890,8 +890,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++;
 
 		sent = 0;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux