From eb1dec7d0dc283a7f61aa574a443a0ab61f8793f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bj=C3=B8rn=20Mork?= Date: Tue, 23 Aug 2016 14:31:05 +0200 Subject: [PATCH] uqmi: fix big endian bugs in MBIM code MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- mbim.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mbim.c b/mbim.c index 33ce19d..f5336b1 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.25.1