Re: [PATCH] staging: ks7010: use little-endian types

2017-06-11 Thread Tobin C. Harding
On Thu, Jun 08, 2017 at 11:06:54PM -0600, Perry Hooker wrote:
> This patch fixes a number of sparse warnings of the form:
> drivers/staging/ks7010/ks_hostif.c:2187:29:
>   warning: incorrect type in assignment (different base types)
> generated when storing little-endian data in variables
> that do not have a specified endianness.
> 
> Signed-off-by: Perry Hooker 

For what it's worth

 Reviewed-By: Tobin C. Harding 

> ---
>  drivers/staging/ks7010/ks_hostif.c | 24 +---
>  1 file changed, 13 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/staging/ks7010/ks_hostif.c 
> b/drivers/staging/ks7010/ks_hostif.c
> index 697347b..db01a48 100644
> --- a/drivers/staging/ks7010/ks_hostif.c
> +++ b/drivers/staging/ks7010/ks_hostif.c
> @@ -1821,7 +1821,7 @@ void hostif_receive(struct ks_wlan_private *priv, 
> unsigned char *p,
>  static
>  void hostif_sme_set_wep(struct ks_wlan_private *priv, int type)
>  {
> - u32 val;
> + __le32 val;
>  
>   switch (type) {
>   case SME_WEP_INDEX_REQUEST:
> @@ -1870,13 +1870,13 @@ void hostif_sme_set_wep(struct ks_wlan_private *priv, 
> int type)
>  }
>  
>  struct wpa_suite_t {
> - unsigned short size;
> + __le16 size;
>   unsigned char suite[4][CIPHER_ID_LEN];
>  } __packed;
>  
>  struct rsn_mode_t {
> - u32 rsn_mode;
> - u16 rsn_capability;
> + __le32 rsn_mode;
> + __le16 rsn_capability;
>  } __packed;
>  
>  static
> @@ -1884,7 +1884,7 @@ void hostif_sme_set_rsn(struct ks_wlan_private *priv, 
> int type)
>  {
>   struct wpa_suite_t wpa_suite;
>   struct rsn_mode_t rsn_mode;
> - u32 val;
> + __le32 val;
>  
>   memset(_suite, 0, sizeof(wpa_suite));
>  
> @@ -1936,7 +1936,8 @@ void hostif_sme_set_rsn(struct ks_wlan_private *priv, 
> int type)
>  
>   hostif_mib_set_request(priv, DOT11_RSN_CONFIG_UNICAST_CIPHER,
>  sizeof(wpa_suite.size) +
> -CIPHER_ID_LEN * wpa_suite.size,
> +CIPHER_ID_LEN *
> +le16_to_cpu(wpa_suite.size),
>  MIB_VALUE_TYPE_OSTRING, _suite);
>   break;
>   case SME_RSN_MCAST_REQUEST:
> @@ -2028,7 +2029,8 @@ void hostif_sme_set_rsn(struct ks_wlan_private *priv, 
> int type)
>  
>   hostif_mib_set_request(priv, DOT11_RSN_CONFIG_AUTH_SUITE,
>  sizeof(wpa_suite.size) +
> -KEY_MGMT_ID_LEN * wpa_suite.size,
> +KEY_MGMT_ID_LEN *
> +le16_to_cpu(wpa_suite.size),
>  MIB_VALUE_TYPE_OSTRING, _suite);
>   break;
>   case SME_RSN_ENABLED_REQUEST:
> @@ -2165,7 +2167,7 @@ void hostif_sme_multicast_set(struct ks_wlan_private 
> *priv)
>   int mc_count;
>   struct netdev_hw_addr *ha;
>   char set_address[NIC_MAX_MCAST_LIST * ETH_ALEN];
> - unsigned long filter_type;
> + __le32 filter_type;
>   int i = 0;
>  
>   DPRINTK(3, "\n");
> @@ -2276,7 +2278,7 @@ void hostif_sme_sleep_set(struct ks_wlan_private *priv)
>  static
>  void hostif_sme_set_key(struct ks_wlan_private *priv, int type)
>  {
> - u32 val;
> + __le32 val;
>  
>   switch (type) {
>   case SME_SET_FLAG:
> @@ -2335,7 +2337,7 @@ static
>  void hostif_sme_set_pmksa(struct ks_wlan_private *priv)
>  {
>   struct pmk_cache_t {
> - u16 size;
> + __le16 size;
>   struct {
>   u8 bssid[ETH_ALEN];
>   u8 pmkid[IW_PMKID_LEN];
> @@ -2366,7 +2368,7 @@ void hostif_sme_set_pmksa(struct ks_wlan_private *priv)
>  static
>  void hostif_sme_execute(struct ks_wlan_private *priv, int event)
>  {
> - u32 val;
> + __le32 val;
>  
>   DPRINTK(3, "event=%d\n", event);
>   switch (event) {
> -- 
> 2.4.11
> 


Re: [PATCH] staging: ks7010: use little-endian types

2017-06-11 Thread Tobin C. Harding
On Thu, Jun 08, 2017 at 11:06:54PM -0600, Perry Hooker wrote:
> This patch fixes a number of sparse warnings of the form:
> drivers/staging/ks7010/ks_hostif.c:2187:29:
>   warning: incorrect type in assignment (different base types)
> generated when storing little-endian data in variables
> that do not have a specified endianness.
> 
> Signed-off-by: Perry Hooker 

For what it's worth

 Reviewed-By: Tobin C. Harding 

> ---
>  drivers/staging/ks7010/ks_hostif.c | 24 +---
>  1 file changed, 13 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/staging/ks7010/ks_hostif.c 
> b/drivers/staging/ks7010/ks_hostif.c
> index 697347b..db01a48 100644
> --- a/drivers/staging/ks7010/ks_hostif.c
> +++ b/drivers/staging/ks7010/ks_hostif.c
> @@ -1821,7 +1821,7 @@ void hostif_receive(struct ks_wlan_private *priv, 
> unsigned char *p,
>  static
>  void hostif_sme_set_wep(struct ks_wlan_private *priv, int type)
>  {
> - u32 val;
> + __le32 val;
>  
>   switch (type) {
>   case SME_WEP_INDEX_REQUEST:
> @@ -1870,13 +1870,13 @@ void hostif_sme_set_wep(struct ks_wlan_private *priv, 
> int type)
>  }
>  
>  struct wpa_suite_t {
> - unsigned short size;
> + __le16 size;
>   unsigned char suite[4][CIPHER_ID_LEN];
>  } __packed;
>  
>  struct rsn_mode_t {
> - u32 rsn_mode;
> - u16 rsn_capability;
> + __le32 rsn_mode;
> + __le16 rsn_capability;
>  } __packed;
>  
>  static
> @@ -1884,7 +1884,7 @@ void hostif_sme_set_rsn(struct ks_wlan_private *priv, 
> int type)
>  {
>   struct wpa_suite_t wpa_suite;
>   struct rsn_mode_t rsn_mode;
> - u32 val;
> + __le32 val;
>  
>   memset(_suite, 0, sizeof(wpa_suite));
>  
> @@ -1936,7 +1936,8 @@ void hostif_sme_set_rsn(struct ks_wlan_private *priv, 
> int type)
>  
>   hostif_mib_set_request(priv, DOT11_RSN_CONFIG_UNICAST_CIPHER,
>  sizeof(wpa_suite.size) +
> -CIPHER_ID_LEN * wpa_suite.size,
> +CIPHER_ID_LEN *
> +le16_to_cpu(wpa_suite.size),
>  MIB_VALUE_TYPE_OSTRING, _suite);
>   break;
>   case SME_RSN_MCAST_REQUEST:
> @@ -2028,7 +2029,8 @@ void hostif_sme_set_rsn(struct ks_wlan_private *priv, 
> int type)
>  
>   hostif_mib_set_request(priv, DOT11_RSN_CONFIG_AUTH_SUITE,
>  sizeof(wpa_suite.size) +
> -KEY_MGMT_ID_LEN * wpa_suite.size,
> +KEY_MGMT_ID_LEN *
> +le16_to_cpu(wpa_suite.size),
>  MIB_VALUE_TYPE_OSTRING, _suite);
>   break;
>   case SME_RSN_ENABLED_REQUEST:
> @@ -2165,7 +2167,7 @@ void hostif_sme_multicast_set(struct ks_wlan_private 
> *priv)
>   int mc_count;
>   struct netdev_hw_addr *ha;
>   char set_address[NIC_MAX_MCAST_LIST * ETH_ALEN];
> - unsigned long filter_type;
> + __le32 filter_type;
>   int i = 0;
>  
>   DPRINTK(3, "\n");
> @@ -2276,7 +2278,7 @@ void hostif_sme_sleep_set(struct ks_wlan_private *priv)
>  static
>  void hostif_sme_set_key(struct ks_wlan_private *priv, int type)
>  {
> - u32 val;
> + __le32 val;
>  
>   switch (type) {
>   case SME_SET_FLAG:
> @@ -2335,7 +2337,7 @@ static
>  void hostif_sme_set_pmksa(struct ks_wlan_private *priv)
>  {
>   struct pmk_cache_t {
> - u16 size;
> + __le16 size;
>   struct {
>   u8 bssid[ETH_ALEN];
>   u8 pmkid[IW_PMKID_LEN];
> @@ -2366,7 +2368,7 @@ void hostif_sme_set_pmksa(struct ks_wlan_private *priv)
>  static
>  void hostif_sme_execute(struct ks_wlan_private *priv, int event)
>  {
> - u32 val;
> + __le32 val;
>  
>   DPRINTK(3, "event=%d\n", event);
>   switch (event) {
> -- 
> 2.4.11
> 


[PATCH] staging: ks7010: use little-endian types

2017-06-08 Thread Perry Hooker
This patch fixes a number of sparse warnings of the form:
drivers/staging/ks7010/ks_hostif.c:2187:29:
warning: incorrect type in assignment (different base types)
generated when storing little-endian data in variables
that do not have a specified endianness.

Signed-off-by: Perry Hooker 
---
 drivers/staging/ks7010/ks_hostif.c | 24 +---
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/ks7010/ks_hostif.c 
b/drivers/staging/ks7010/ks_hostif.c
index 697347b..db01a48 100644
--- a/drivers/staging/ks7010/ks_hostif.c
+++ b/drivers/staging/ks7010/ks_hostif.c
@@ -1821,7 +1821,7 @@ void hostif_receive(struct ks_wlan_private *priv, 
unsigned char *p,
 static
 void hostif_sme_set_wep(struct ks_wlan_private *priv, int type)
 {
-   u32 val;
+   __le32 val;
 
switch (type) {
case SME_WEP_INDEX_REQUEST:
@@ -1870,13 +1870,13 @@ void hostif_sme_set_wep(struct ks_wlan_private *priv, 
int type)
 }
 
 struct wpa_suite_t {
-   unsigned short size;
+   __le16 size;
unsigned char suite[4][CIPHER_ID_LEN];
 } __packed;
 
 struct rsn_mode_t {
-   u32 rsn_mode;
-   u16 rsn_capability;
+   __le32 rsn_mode;
+   __le16 rsn_capability;
 } __packed;
 
 static
@@ -1884,7 +1884,7 @@ void hostif_sme_set_rsn(struct ks_wlan_private *priv, int 
type)
 {
struct wpa_suite_t wpa_suite;
struct rsn_mode_t rsn_mode;
-   u32 val;
+   __le32 val;
 
memset(_suite, 0, sizeof(wpa_suite));
 
@@ -1936,7 +1936,8 @@ void hostif_sme_set_rsn(struct ks_wlan_private *priv, int 
type)
 
hostif_mib_set_request(priv, DOT11_RSN_CONFIG_UNICAST_CIPHER,
   sizeof(wpa_suite.size) +
-  CIPHER_ID_LEN * wpa_suite.size,
+  CIPHER_ID_LEN *
+  le16_to_cpu(wpa_suite.size),
   MIB_VALUE_TYPE_OSTRING, _suite);
break;
case SME_RSN_MCAST_REQUEST:
@@ -2028,7 +2029,8 @@ void hostif_sme_set_rsn(struct ks_wlan_private *priv, int 
type)
 
hostif_mib_set_request(priv, DOT11_RSN_CONFIG_AUTH_SUITE,
   sizeof(wpa_suite.size) +
-  KEY_MGMT_ID_LEN * wpa_suite.size,
+  KEY_MGMT_ID_LEN *
+  le16_to_cpu(wpa_suite.size),
   MIB_VALUE_TYPE_OSTRING, _suite);
break;
case SME_RSN_ENABLED_REQUEST:
@@ -2165,7 +2167,7 @@ void hostif_sme_multicast_set(struct ks_wlan_private 
*priv)
int mc_count;
struct netdev_hw_addr *ha;
char set_address[NIC_MAX_MCAST_LIST * ETH_ALEN];
-   unsigned long filter_type;
+   __le32 filter_type;
int i = 0;
 
DPRINTK(3, "\n");
@@ -2276,7 +2278,7 @@ void hostif_sme_sleep_set(struct ks_wlan_private *priv)
 static
 void hostif_sme_set_key(struct ks_wlan_private *priv, int type)
 {
-   u32 val;
+   __le32 val;
 
switch (type) {
case SME_SET_FLAG:
@@ -2335,7 +2337,7 @@ static
 void hostif_sme_set_pmksa(struct ks_wlan_private *priv)
 {
struct pmk_cache_t {
-   u16 size;
+   __le16 size;
struct {
u8 bssid[ETH_ALEN];
u8 pmkid[IW_PMKID_LEN];
@@ -2366,7 +2368,7 @@ void hostif_sme_set_pmksa(struct ks_wlan_private *priv)
 static
 void hostif_sme_execute(struct ks_wlan_private *priv, int event)
 {
-   u32 val;
+   __le32 val;
 
DPRINTK(3, "event=%d\n", event);
switch (event) {
-- 
2.4.11



[PATCH] staging: ks7010: use little-endian types

2017-06-08 Thread Perry Hooker
This patch fixes a number of sparse warnings of the form:
drivers/staging/ks7010/ks_hostif.c:2187:29:
warning: incorrect type in assignment (different base types)
generated when storing little-endian data in variables
that do not have a specified endianness.

Signed-off-by: Perry Hooker 
---
 drivers/staging/ks7010/ks_hostif.c | 24 +---
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/ks7010/ks_hostif.c 
b/drivers/staging/ks7010/ks_hostif.c
index 697347b..db01a48 100644
--- a/drivers/staging/ks7010/ks_hostif.c
+++ b/drivers/staging/ks7010/ks_hostif.c
@@ -1821,7 +1821,7 @@ void hostif_receive(struct ks_wlan_private *priv, 
unsigned char *p,
 static
 void hostif_sme_set_wep(struct ks_wlan_private *priv, int type)
 {
-   u32 val;
+   __le32 val;
 
switch (type) {
case SME_WEP_INDEX_REQUEST:
@@ -1870,13 +1870,13 @@ void hostif_sme_set_wep(struct ks_wlan_private *priv, 
int type)
 }
 
 struct wpa_suite_t {
-   unsigned short size;
+   __le16 size;
unsigned char suite[4][CIPHER_ID_LEN];
 } __packed;
 
 struct rsn_mode_t {
-   u32 rsn_mode;
-   u16 rsn_capability;
+   __le32 rsn_mode;
+   __le16 rsn_capability;
 } __packed;
 
 static
@@ -1884,7 +1884,7 @@ void hostif_sme_set_rsn(struct ks_wlan_private *priv, int 
type)
 {
struct wpa_suite_t wpa_suite;
struct rsn_mode_t rsn_mode;
-   u32 val;
+   __le32 val;
 
memset(_suite, 0, sizeof(wpa_suite));
 
@@ -1936,7 +1936,8 @@ void hostif_sme_set_rsn(struct ks_wlan_private *priv, int 
type)
 
hostif_mib_set_request(priv, DOT11_RSN_CONFIG_UNICAST_CIPHER,
   sizeof(wpa_suite.size) +
-  CIPHER_ID_LEN * wpa_suite.size,
+  CIPHER_ID_LEN *
+  le16_to_cpu(wpa_suite.size),
   MIB_VALUE_TYPE_OSTRING, _suite);
break;
case SME_RSN_MCAST_REQUEST:
@@ -2028,7 +2029,8 @@ void hostif_sme_set_rsn(struct ks_wlan_private *priv, int 
type)
 
hostif_mib_set_request(priv, DOT11_RSN_CONFIG_AUTH_SUITE,
   sizeof(wpa_suite.size) +
-  KEY_MGMT_ID_LEN * wpa_suite.size,
+  KEY_MGMT_ID_LEN *
+  le16_to_cpu(wpa_suite.size),
   MIB_VALUE_TYPE_OSTRING, _suite);
break;
case SME_RSN_ENABLED_REQUEST:
@@ -2165,7 +2167,7 @@ void hostif_sme_multicast_set(struct ks_wlan_private 
*priv)
int mc_count;
struct netdev_hw_addr *ha;
char set_address[NIC_MAX_MCAST_LIST * ETH_ALEN];
-   unsigned long filter_type;
+   __le32 filter_type;
int i = 0;
 
DPRINTK(3, "\n");
@@ -2276,7 +2278,7 @@ void hostif_sme_sleep_set(struct ks_wlan_private *priv)
 static
 void hostif_sme_set_key(struct ks_wlan_private *priv, int type)
 {
-   u32 val;
+   __le32 val;
 
switch (type) {
case SME_SET_FLAG:
@@ -2335,7 +2337,7 @@ static
 void hostif_sme_set_pmksa(struct ks_wlan_private *priv)
 {
struct pmk_cache_t {
-   u16 size;
+   __le16 size;
struct {
u8 bssid[ETH_ALEN];
u8 pmkid[IW_PMKID_LEN];
@@ -2366,7 +2368,7 @@ void hostif_sme_set_pmksa(struct ks_wlan_private *priv)
 static
 void hostif_sme_execute(struct ks_wlan_private *priv, int event)
 {
-   u32 val;
+   __le32 val;
 
DPRINTK(3, "event=%d\n", event);
switch (event) {
-- 
2.4.11