linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mwifiex: Fixed endianness for event TLV type TLV_BTCOEX_WL_SCANTIME
@ 2016-06-16  4:19 Prasun Maiti
  2016-06-24  6:56 ` Prasun Maiti
  2016-06-29 15:52 ` Kalle Valo
  0 siblings, 2 replies; 9+ messages in thread
From: Prasun Maiti @ 2016-06-16  4:19 UTC (permalink / raw)
  To: Amitkumar Karwar, Nishant Sarmukadam
  Cc: Linux Wireless, Linux Next, Linux Kernel

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 <prasunmaiti87@gmail.com>
---
 drivers/net/wireless/marvell/mwifiex/sta_event.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] mwifiex: Fixed endianness for event TLV type TLV_BTCOEX_WL_SCANTIME
  2016-06-16  4:19 [PATCH] mwifiex: Fixed endianness for event TLV type TLV_BTCOEX_WL_SCANTIME Prasun Maiti
@ 2016-06-24  6:56 ` Prasun Maiti
  2016-06-30  7:35   ` Amitkumar Karwar
  2016-06-29 15:52 ` Kalle Valo
  1 sibling, 1 reply; 9+ messages in thread
From: Prasun Maiti @ 2016-06-24  6:56 UTC (permalink / raw)
  To: Amitkumar Karwar, Nishant Sarmukadam, Kalle Valo
  Cc: Linux Wireless, Linux Next, Linux Kernel

On Thu, Jun 16, 2016 at 9:49 AM, Prasun Maiti <prasunmaiti87@gmail.com> wrote:
> 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 <prasunmaiti87@gmail.com>
> ---
>  drivers/net/wireless/marvell/mwifiex/sta_event.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> 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
>

Hi Amitkumar,

Please let me know your opinion about this patch.

-- 
Thanks,
Prasun

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: mwifiex: Fixed endianness for event TLV type TLV_BTCOEX_WL_SCANTIME
  2016-06-16  4:19 [PATCH] mwifiex: Fixed endianness for event TLV type TLV_BTCOEX_WL_SCANTIME Prasun Maiti
  2016-06-24  6:56 ` Prasun Maiti
@ 2016-06-29 15:52 ` Kalle Valo
  1 sibling, 0 replies; 9+ messages in thread
From: Kalle Valo @ 2016-06-29 15:52 UTC (permalink / raw)
  To: Prasun Maiti
  Cc: Amitkumar Karwar, Nishant Sarmukadam, Linux Wireless, Linux Next,
	Linux Kernel

Prasun Maiti <prasunmaiti87@gmail.com> wrote:
> 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 <prasunmaiti87@gmail.com>

I would like to see Reviewed-by from someone else before I apply this.

-- 
Sent by pwcli
https://patchwork.kernel.org/patch/9179811/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: [PATCH] mwifiex: Fixed endianness for event TLV type TLV_BTCOEX_WL_SCANTIME
  2016-06-24  6:56 ` Prasun Maiti
@ 2016-06-30  7:35   ` Amitkumar Karwar
  2016-06-30  8:31     ` [PATCH v2] mwifiex: Fix " Prasun Maiti
  2016-06-30  8:39     ` [PATCH] mwifiex: Fixed " Prasun Maiti
  0 siblings, 2 replies; 9+ messages in thread
From: Amitkumar Karwar @ 2016-06-30  7:35 UTC (permalink / raw)
  To: Prasun Maiti, Nishant Sarmukadam, Kalle Valo
  Cc: Linux Wireless, Linux Next, Linux Kernel

Hi Prasun,

> From: Prasun Maiti [mailto:prasunmaiti87@gmail.com]
> Sent: Friday, June 24, 2016 12:27 PM
> To: Amitkumar Karwar; Nishant Sarmukadam; Kalle Valo
> Cc: Linux Wireless; Linux Next; Linux Kernel
> Subject: Re: [PATCH] mwifiex: Fixed endianness for event TLV type
> TLV_BTCOEX_WL_SCANTIME
> 
> On Thu, Jun 16, 2016 at 9:49 AM, Prasun Maiti <prasunmaiti87@gmail.com>
> wrote:
> > 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 <prasunmaiti87@gmail.com>
> > ---
> >  drivers/net/wireless/marvell/mwifiex/sta_event.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > 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
> >

Along with this change, you need to define these elements as __le16 in scan_tlv structure. Ensure that sparse compilation is passed with your final patch.

Regards,
Amitkumar

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2] mwifiex: Fix endianness for event TLV type TLV_BTCOEX_WL_SCANTIME
  2016-06-30  7:35   ` Amitkumar Karwar
@ 2016-06-30  8:31     ` Prasun Maiti
  2016-06-30  8:37       ` Amitkumar Karwar
  2016-07-08 13:47       ` [v2] " Kalle Valo
  2016-06-30  8:39     ` [PATCH] mwifiex: Fixed " Prasun Maiti
  1 sibling, 2 replies; 9+ messages in thread
From: Prasun Maiti @ 2016-06-30  8:31 UTC (permalink / raw)
  To: Amitkumar Karwar
  Cc: Nishant Sarmukadam, Linux Wireless, Linux Next, Linux Kernel, Kalle Valo

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 <prasunmaiti87@gmail.com>
---
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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: [PATCH v2] mwifiex: Fix endianness for event TLV type TLV_BTCOEX_WL_SCANTIME
  2016-06-30  8:31     ` [PATCH v2] mwifiex: Fix " Prasun Maiti
@ 2016-06-30  8:37       ` Amitkumar Karwar
  2016-06-30  8:41         ` Prasun Maiti
  2016-07-08 13:47       ` [v2] " Kalle Valo
  1 sibling, 1 reply; 9+ messages in thread
From: Amitkumar Karwar @ 2016-06-30  8:37 UTC (permalink / raw)
  To: Prasun Maiti
  Cc: Nishant Sarmukadam, Linux Wireless, Linux Next, Linux Kernel, Kalle Valo

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 <prasunmaiti87@gmail.com>
> ---
> 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 <akarwar@marvell.com>

Regards,
Amitkumar

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] mwifiex: Fixed endianness for event TLV type TLV_BTCOEX_WL_SCANTIME
  2016-06-30  7:35   ` Amitkumar Karwar
  2016-06-30  8:31     ` [PATCH v2] mwifiex: Fix " Prasun Maiti
@ 2016-06-30  8:39     ` Prasun Maiti
  1 sibling, 0 replies; 9+ messages in thread
From: Prasun Maiti @ 2016-06-30  8:39 UTC (permalink / raw)
  To: Amitkumar Karwar
  Cc: Nishant Sarmukadam, Kalle Valo, Linux Wireless, Linux Next, Linux Kernel

On Thu, Jun 30, 2016 at 1:05 PM, Amitkumar Karwar <akarwar@marvell.com> wrote:
> Hi Prasun,
>
>> From: Prasun Maiti [mailto:prasunmaiti87@gmail.com]
>> Sent: Friday, June 24, 2016 12:27 PM
>> To: Amitkumar Karwar; Nishant Sarmukadam; Kalle Valo
>> Cc: Linux Wireless; Linux Next; Linux Kernel
>> Subject: Re: [PATCH] mwifiex: Fixed endianness for event TLV type
>> TLV_BTCOEX_WL_SCANTIME
>>
>> On Thu, Jun 16, 2016 at 9:49 AM, Prasun Maiti <prasunmaiti87@gmail.com>
>> wrote:
>> > 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 <prasunmaiti87@gmail.com>
>> > ---
>> >  drivers/net/wireless/marvell/mwifiex/sta_event.c | 4 ++--
>> >  1 file changed, 2 insertions(+), 2 deletions(-)
>> >
>> > 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
>> >
>
> Along with this change, you need to define these elements as __le16 in scan_tlv structure. Ensure that sparse compilation is passed with your final patch.
>

Hi Amitkumar,

Thanks for your suggestion.
I have added this in scan_tlv structure to fix the sparse compilation
warnings. Updated patch v2 is sent.
Please verify this.

-- 
Thanks,
Prasun

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2] mwifiex: Fix endianness for event TLV type TLV_BTCOEX_WL_SCANTIME
  2016-06-30  8:37       ` Amitkumar Karwar
@ 2016-06-30  8:41         ` Prasun Maiti
  0 siblings, 0 replies; 9+ messages in thread
From: Prasun Maiti @ 2016-06-30  8:41 UTC (permalink / raw)
  To: Amitkumar Karwar
  Cc: Nishant Sarmukadam, Linux Wireless, Linux Next, Linux Kernel, Kalle Valo

On Thu, Jun 30, 2016 at 2:07 PM, Amitkumar Karwar <akarwar@marvell.com> wrote:
> Hi Prasun,
> Updated change looks fine to me.
>
> Acked-by: Amitkumar Karwar <akarwar@marvell.com>
>
> Regards,
> Amitkumar

Hi AmitKumar,

Thanks for your verification.

-- 
Thanks,
Prasun

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [v2] mwifiex: Fix endianness for event TLV type TLV_BTCOEX_WL_SCANTIME
  2016-06-30  8:31     ` [PATCH v2] mwifiex: Fix " Prasun Maiti
  2016-06-30  8:37       ` Amitkumar Karwar
@ 2016-07-08 13:47       ` Kalle Valo
  1 sibling, 0 replies; 9+ messages in thread
From: Kalle Valo @ 2016-07-08 13:47 UTC (permalink / raw)
  To: Prasun Maiti
  Cc: Amitkumar Karwar, Nishant Sarmukadam, Linux Wireless, Linux Next,
	Linux Kernel

Prasun Maiti <prasunmaiti87@gmail.com> wrote:
> 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 <prasunmaiti87@gmail.com>
> Acked-by: Amitkumar Karwar <akarwar@marvell.com>

Thanks, 1 patch applied to wireless-drivers-next.git:

c18b104dd249 mwifiex: Fix endianness for event TLV type TLV_BTCOEX_WL_SCANTIME

-- 
Sent by pwcli
https://patchwork.kernel.org/patch/9206939/

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2016-07-08 13:47 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-16  4:19 [PATCH] mwifiex: Fixed endianness for event TLV type TLV_BTCOEX_WL_SCANTIME Prasun Maiti
2016-06-24  6:56 ` Prasun Maiti
2016-06-30  7:35   ` Amitkumar Karwar
2016-06-30  8:31     ` [PATCH v2] mwifiex: Fix " Prasun Maiti
2016-06-30  8:37       ` Amitkumar Karwar
2016-06-30  8:41         ` Prasun Maiti
2016-07-08 13:47       ` [v2] " Kalle Valo
2016-06-30  8:39     ` [PATCH] mwifiex: Fixed " Prasun Maiti
2016-06-29 15:52 ` Kalle Valo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).