From patchwork Thu Jun 30 08:31:23 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prasun Maiti X-Patchwork-Id: 9206939 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 929EF60752 for ; Thu, 30 Jun 2016 08:31:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 814592865A for ; Thu, 30 Jun 2016 08:31:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 742FD2867B; Thu, 30 Jun 2016 08:31:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1C4FC2865A for ; Thu, 30 Jun 2016 08:31:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751994AbcF3Ibd (ORCPT ); Thu, 30 Jun 2016 04:31:33 -0400 Received: from mail-pa0-f66.google.com ([209.85.220.66]:35200 "EHLO mail-pa0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751703AbcF3Iba (ORCPT ); Thu, 30 Jun 2016 04:31:30 -0400 Received: by mail-pa0-f66.google.com with SMTP id hf6so6597758pac.2; Thu, 30 Jun 2016 01:31:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ls5TuYFAf77HhyLfsrZGT7ZvRYVmMImUfBI7wJbMnqc=; b=dO1WLrfPOOjMupUn+4GprUPc84vWyXAYhe44Dq1/0XQ5kdM4v0yCn40koyuXZXj/0+ w92Kj3a716LdCUBWYbntnlpQA0u9wYIuYmoDUGs93oh3s7bdsx7pHPuWLaTHEdG7hx1X Yodf4HTtS9Jr6DRiietFiqkcOci08HYYw8VDAyYA5YwN09ymaS+aeSlhh+YSrCI40+ri BBaOA8Nx+jGSjFqrjXJNb9aGHlDnIG2NbXKDQ3sTJZtP/6hOFNkDxKEB2R5M2X/WjrUs 4S8rtTKfuS0zL3hMGRzpZByK3JME3qczo63/k6sSg3gwn1ii00JIoelLxECgEq55UvRr ouwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ls5TuYFAf77HhyLfsrZGT7ZvRYVmMImUfBI7wJbMnqc=; b=B0aSLJeETr2MCL9dNzUCGPbF0+LvGA7z3DuCjXCHF1myePYPaYF4uvIHxp65KKZ60z E0mLGUE7HXjTXAOSUu77aoTBoPHPno3dvRwPaAqbJNwcclvaXHD2zgjX5Z0i4DokeLbH cZagS9LX1QH6Ei8C9j3Jps8H/6wwjRD7oKyFlhZV7Ph6FVOEuyH1mumjq/2ZfXogEMRf Orklm+ImsmSGHjhS+ZeuJoTdKnavWzXr7yWQMoqiFwTQEw5tfVdhNk6aYHDAjVoIErRr LN1F19KLa7jVXMbxVkpL0v/bnHR0nwpkpqa6Rfn6CFboDkQ9s1wDQI9F3t5O3qSVbVhx 2VNg== X-Gm-Message-State: ALyK8tLkGPewfRaMvNRSdXnj0N7stY57Y3ZZWCw6FCaPY93nnBsDC4MvkBnWLPK+tReOSg== X-Received: by 10.66.253.70 with SMTP id zy6mr19025860pac.55.1467275489519; Thu, 30 Jun 2016 01:31:29 -0700 (PDT) Received: from asl--078.alumnus.co.in (gw.alumnux.com. [182.74.215.94]) by smtp.gmail.com with ESMTPSA id 203sm3535058pfz.35.2016.06.30.01.31.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 30 Jun 2016 01:31:29 -0700 (PDT) From: Prasun Maiti To: Amitkumar Karwar Cc: Nishant Sarmukadam , Linux Wireless , Linux Next , Linux Kernel , Kalle Valo Subject: [PATCH v2] mwifiex: Fix endianness for event TLV type TLV_BTCOEX_WL_SCANTIME Date: Thu, 30 Jun 2016 14:01:23 +0530 Message-Id: <1467275483-24091-1-git-send-email-prasunmaiti87@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <10cf2879532349d29143ecbac3b459b7@SC-EXCH04.marvell.com> References: <10cf2879532349d29143ecbac3b459b7@SC-EXCH04.marvell.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The two members min_scan_time and max_scan_time of structure "mwifiex_ie_types_btcoex_scan_time" are of two bytes each. The values are assigned directtly from firmware without endian conversion handling. So, wrong datas will get saved in big-endian systems. This patch converts the values into cpu's byte order before assigning them into the local members. Signed-off-by: Prasun Maiti Acked-by: Amitkumar Karwar --- Changes in v2: - Fixed the following sparse compilation warnings: * sta_event.c:477:55: warning: cast to restricted __le16 * sta_event.c:478:55: warning: cast to restricted __le16 drivers/net/wireless/marvell/mwifiex/fw.h | 4 ++-- drivers/net/wireless/marvell/mwifiex/sta_event.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/net/wireless/marvell/mwifiex/fw.h b/drivers/net/wireless/marvell/mwifiex/fw.h index 8e4145a..03d3edf 100644 --- a/drivers/net/wireless/marvell/mwifiex/fw.h +++ b/drivers/net/wireless/marvell/mwifiex/fw.h @@ -1958,8 +1958,8 @@ struct mwifiex_ie_types_btcoex_scan_time { struct mwifiex_ie_types_header header; u8 coex_scan; u8 reserved; - u16 min_scan_time; - u16 max_scan_time; + __le16 min_scan_time; + __le16 max_scan_time; } __packed; struct mwifiex_ie_types_btcoex_aggr_win_size { diff --git a/drivers/net/wireless/marvell/mwifiex/sta_event.c b/drivers/net/wireless/marvell/mwifiex/sta_event.c index 0104108..7dff452 100644 --- a/drivers/net/wireless/marvell/mwifiex/sta_event.c +++ b/drivers/net/wireless/marvell/mwifiex/sta_event.c @@ -474,8 +474,8 @@ void mwifiex_bt_coex_wlan_param_update_event(struct mwifiex_private *priv, scantlv = (struct mwifiex_ie_types_btcoex_scan_time *)tlv; adapter->coex_scan = scantlv->coex_scan; - adapter->coex_min_scan_time = scantlv->min_scan_time; - adapter->coex_max_scan_time = scantlv->max_scan_time; + adapter->coex_min_scan_time = le16_to_cpu(scantlv->min_scan_time); + adapter->coex_max_scan_time = le16_to_cpu(scantlv->max_scan_time); break; default: