From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752147AbcF3JWH (ORCPT ); Thu, 30 Jun 2016 05:22:07 -0400 Received: from mx0b-0016f401.pphosted.com ([67.231.156.173]:15457 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751895AbcF3JWE convert rfc822-to-8bit (ORCPT ); Thu, 30 Jun 2016 05:22:04 -0400 From: Amitkumar Karwar To: Prasun Maiti CC: Nishant Sarmukadam , Linux Wireless , Linux Next , Linux Kernel , Kalle Valo Subject: RE: [PATCH v2] mwifiex: Fix endianness for event TLV type TLV_BTCOEX_WL_SCANTIME Thread-Topic: [PATCH v2] mwifiex: Fix endianness for event TLV type TLV_BTCOEX_WL_SCANTIME Thread-Index: AQHR0qnNs0GRM5kSKkuGOw14AEGBZqABryvw Date: Thu, 30 Jun 2016 08:37:15 +0000 Message-ID: <9f524718509042ac904b2db09081048e@SC-EXCH04.marvell.com> References: <10cf2879532349d29143ecbac3b459b7@SC-EXCH04.marvell.com> <1467275483-24091-1-git-send-email-prasunmaiti87@gmail.com> In-Reply-To: <1467275483-24091-1-git-send-email-prasunmaiti87@gmail.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.93.176.43] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-06-30_04:,, signatures=0 X-Proofpoint-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1604210000 definitions=main-1606300080 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Prasun, > -----Original Message----- > From: Prasun Maiti [mailto:prasunmaiti87@gmail.com] > Sent: Thursday, June 30, 2016 2:01 PM > 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 > > 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 > --- > 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(-) > > 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: > -- > 1.9.1 Updated change looks fine to me. Acked-by: Amitkumar Karwar Regards, Amitkumar