[LEDE-DEV] [PATCH] uqmi: fix big endian bugs in MBIM code

Bjørn Mork bjorn at mork.no
Tue Aug 23 05:31:05 PDT 2016


All MBIM integer fields are 32bit little endian.  So we need to convert
then all on big endian systems.

Fixes: e69bf24b00d8 ("uqmi: add support for MBIM devices with QMI service")
Signed-off-by: Bjørn Mork <bjorn at mork.no>
---
 mbim.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/mbim.c b/mbim.c
index 33ce19da0f9f..f5336b15a7f6 100644
--- a/mbim.c
+++ b/mbim.c
@@ -39,12 +39,12 @@ bool is_mbim_qmi(struct mbim_command_message *msg)
 void mbim_qmi_cmd(struct mbim_command_message *msg, int len, uint16_t tid)
 {
 	msg->header.type = cpu_to_le32(MBIM_MESSAGE_TYPE_COMMAND);
-	msg->header.length = sizeof(*msg) + len;
+	msg->header.length = cpu_to_le32(sizeof(*msg) + len);
 	msg->header.transaction_id = cpu_to_le32(tid);
-	msg->fragment_header.total = 1;
+	msg->fragment_header.total = cpu_to_le32(1);
 	msg->fragment_header.current = 0;
 	memcpy(msg->service_id, qmiuuid, 16);
 	msg->command_id = cpu_to_le32(MBIM_CID_QMI_MSG);
 	msg->command_type = cpu_to_le32(MBIM_MESSAGE_COMMAND_TYPE_SET);
-	msg->buffer_length = len;
+	msg->buffer_length = cpu_to_le32(len);
 }
-- 
2.9.3




More information about the Lede-dev mailing list