DORMANTno replies

[PATCH] use correct size to copy 'direction' value

From: Iain Hibbert <hidden>
Date: 2011-03-20 20:24:22
Subsystem: the rest · Maintainer: Linus Torvalds

frm.in is stored as an uint8_t, so we cannot copy an int there
directly.  use an intermediate variable so that it also works
on big-endian systems.
---
 src/hcidump.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/src/hcidump.c b/src/hcidump.c
index af086c7..844720d 100644
--- a/src/hcidump.c
+++ b/src/hcidump.c
@@ -299,7 +299,8 @@ static int process_frames(int dev, int sock, int fd, unsigned long flags)
 		while (cmsg) {
 			switch (cmsg->cmsg_type) {
 			case HCI_CMSG_DIR:
-				memcpy(&frm.in, CMSG_DATA(cmsg), sizeof(int));
+				memcpy(&i, CMSG_DATA(cmsg), sizeof(int));
+				frm.in = (uint8_t)i;
 				break;
 			case HCI_CMSG_TSTAMP:
 				memcpy(&frm.ts, CMSG_DATA(cmsg),
-- 
1.7.3.4
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help