* [PATCH] rndis_wlan: fix sparse warnings
@ 2008-02-20 10:47 Johannes Berg
2008-02-20 20:20 ` John W. Linville
2008-02-24 11:02 ` Jussi Kivilinna
0 siblings, 2 replies; 5+ messages in thread
From: Johannes Berg @ 2008-02-20 10:47 UTC (permalink / raw)
To: John Linville; +Cc: Jussi Kivilinna, linux-wireless
It is obviously wrong to use an enum in a little endian struct,
and those other enums should be declared differently.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
---
drivers/net/wireless/rndis_wlan.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
--- everything.orig/drivers/net/wireless/rndis_wlan.c 2008-02-20 11:43:22.000000000 +0100
+++ everything/drivers/net/wireless/rndis_wlan.c 2008-02-20 11:45:35.000000000 +0100
@@ -228,9 +228,9 @@ struct NDIS_WLAN_BSSID_EX {
struct NDIS_802_11_SSID Ssid;
__le32 Privacy;
__le32 Rssi;
- enum NDIS_802_11_NETWORK_TYPE NetworkTypeInUse;
+ __le32 NetworkTypeInUse;
struct NDIS_802_11_CONFIGURATION Configuration;
- enum NDIS_802_11_NETWORK_INFRASTRUCTURE InfrastructureMode;
+ __le32 InfrastructureMode;
u8 SupportedRates[NDIS_802_11_LENGTH_RATES_EX];
__le32 IELength;
u8 IEs[0];
@@ -279,11 +279,11 @@ struct RNDIS_CONFIG_PARAMETER_INFOBUFFER
} __attribute__((packed));
/* these have to match what is in wpa_supplicant */
-enum { WPA_ALG_NONE, WPA_ALG_WEP, WPA_ALG_TKIP, WPA_ALG_CCMP } wpa_alg;
-enum { CIPHER_NONE, CIPHER_WEP40, CIPHER_TKIP, CIPHER_CCMP, CIPHER_WEP104 }
- wpa_cipher;
-enum { KEY_MGMT_802_1X, KEY_MGMT_PSK, KEY_MGMT_NONE, KEY_MGMT_802_1X_NO_WPA,
- KEY_MGMT_WPA_NONE } wpa_key_mgmt;
+enum wpa_alg { WPA_ALG_NONE, WPA_ALG_WEP, WPA_ALG_TKIP, WPA_ALG_CCMP };
+enum wpa_cipher { CIPHER_NONE, CIPHER_WEP40, CIPHER_TKIP, CIPHER_CCMP,
+ CIPHER_WEP104 };
+enum wpa_key_mgmt { KEY_MGMT_802_1X, KEY_MGMT_PSK, KEY_MGMT_NONE,
+ KEY_MGMT_802_1X_NO_WPA, KEY_MGMT_WPA_NONE };
/*
* private data
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] rndis_wlan: fix sparse warnings
2008-02-20 10:47 [PATCH] rndis_wlan: fix sparse warnings Johannes Berg
@ 2008-02-20 20:20 ` John W. Linville
2008-02-21 9:29 ` Johannes Berg
2008-02-24 11:02 ` Jussi Kivilinna
1 sibling, 1 reply; 5+ messages in thread
From: John W. Linville @ 2008-02-20 20:20 UTC (permalink / raw)
To: Johannes Berg; +Cc: Jussi Kivilinna, linux-wireless
On Wed, Feb 20, 2008 at 11:47:45AM +0100, Johannes Berg wrote:
> It is obviously wrong to use an enum in a little endian struct,
> and those other enums should be declared differently.
>
> Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
> ---
> drivers/net/wireless/rndis_wlan.c | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
>
> --- everything.orig/drivers/net/wireless/rndis_wlan.c 2008-02-20 11:43:22.000000000 +0100
> +++ everything/drivers/net/wireless/rndis_wlan.c 2008-02-20 11:45:35.000000000 +0100
> @@ -228,9 +228,9 @@ struct NDIS_WLAN_BSSID_EX {
> struct NDIS_802_11_SSID Ssid;
> __le32 Privacy;
> __le32 Rssi;
> - enum NDIS_802_11_NETWORK_TYPE NetworkTypeInUse;
> + __le32 NetworkTypeInUse;
> struct NDIS_802_11_CONFIGURATION Configuration;
> - enum NDIS_802_11_NETWORK_INFRASTRUCTURE InfrastructureMode;
> + __le32 InfrastructureMode;
> u8 SupportedRates[NDIS_802_11_LENGTH_RATES_EX];
> __le32 IELength;
> u8 IEs[0];
This suggests that the values in the enum need to be explicitly
defined, does it not?
--
John W. Linville
linville@tuxdriver.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] rndis_wlan: fix sparse warnings
2008-02-20 20:20 ` John W. Linville
@ 2008-02-21 9:29 ` Johannes Berg
2008-02-21 16:20 ` John W. Linville
0 siblings, 1 reply; 5+ messages in thread
From: Johannes Berg @ 2008-02-21 9:29 UTC (permalink / raw)
To: John W. Linville; +Cc: Jussi Kivilinna, linux-wireless
[-- Attachment #1: Type: text/plain, Size: 986 bytes --]
> > --- everything.orig/drivers/net/wireless/rndis_wlan.c 2008-02-20 11:43:22.000000000 +0100
> > +++ everything/drivers/net/wireless/rndis_wlan.c 2008-02-20 11:45:35.000000000 +0100
> > @@ -228,9 +228,9 @@ struct NDIS_WLAN_BSSID_EX {
> > struct NDIS_802_11_SSID Ssid;
> > __le32 Privacy;
> > __le32 Rssi;
> > - enum NDIS_802_11_NETWORK_TYPE NetworkTypeInUse;
> > + __le32 NetworkTypeInUse;
> > struct NDIS_802_11_CONFIGURATION Configuration;
> > - enum NDIS_802_11_NETWORK_INFRASTRUCTURE InfrastructureMode;
> > + __le32 InfrastructureMode;
> > u8 SupportedRates[NDIS_802_11_LENGTH_RATES_EX];
> > __le32 IELength;
> > u8 IEs[0];
>
> This suggests that the values in the enum need to be explicitly
> defined, does it not?
Yeah, well, it is probably understood that those values are from
hardware. We don't always explicitly define them even when they are
defined elsewhere since afaik C guarantees starting at 0 and increasing
order.
johannes
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] rndis_wlan: fix sparse warnings
2008-02-21 9:29 ` Johannes Berg
@ 2008-02-21 16:20 ` John W. Linville
0 siblings, 0 replies; 5+ messages in thread
From: John W. Linville @ 2008-02-21 16:20 UTC (permalink / raw)
To: Johannes Berg; +Cc: Jussi Kivilinna, linux-wireless
On Thu, Feb 21, 2008 at 10:29:17AM +0100, Johannes Berg wrote:
>
> > > --- everything.orig/drivers/net/wireless/rndis_wlan.c 2008-02-20 11:43:22.000000000 +0100
> > > +++ everything/drivers/net/wireless/rndis_wlan.c 2008-02-20 11:45:35.000000000 +0100
> > > @@ -228,9 +228,9 @@ struct NDIS_WLAN_BSSID_EX {
> > > struct NDIS_802_11_SSID Ssid;
> > > __le32 Privacy;
> > > __le32 Rssi;
> > > - enum NDIS_802_11_NETWORK_TYPE NetworkTypeInUse;
> > > + __le32 NetworkTypeInUse;
> > > struct NDIS_802_11_CONFIGURATION Configuration;
> > > - enum NDIS_802_11_NETWORK_INFRASTRUCTURE InfrastructureMode;
> > > + __le32 InfrastructureMode;
> > > u8 SupportedRates[NDIS_802_11_LENGTH_RATES_EX];
> > > __le32 IELength;
> > > u8 IEs[0];
> >
> > This suggests that the values in the enum need to be explicitly
> > defined, does it not?
>
> Yeah, well, it is probably understood that those values are from
> hardware. We don't always explicitly define them even when they are
> defined elsewhere since afaik C guarantees starting at 0 and increasing
> order.
Ah, nevermind...I see that the enum values are being converted to/from
cpu-endian before use.
Thanks,
John
--
John W. Linville
linville@tuxdriver.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] rndis_wlan: fix sparse warnings
2008-02-20 10:47 [PATCH] rndis_wlan: fix sparse warnings Johannes Berg
2008-02-20 20:20 ` John W. Linville
@ 2008-02-24 11:02 ` Jussi Kivilinna
1 sibling, 0 replies; 5+ messages in thread
From: Jussi Kivilinna @ 2008-02-24 11:02 UTC (permalink / raw)
To: Johannes Berg; +Cc: John Linville, linux-wireless
On Wed, 2008-02-20 at 11:47 +0100, Johannes Berg wrote:
> It is obviously wrong to use an enum in a little endian struct,
> and those other enums should be declared differently.
>
> Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Thanks, and also works as nice style cleanup.
Acked-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
> ---
> drivers/net/wireless/rndis_wlan.c | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
>
> --- everything.orig/drivers/net/wireless/rndis_wlan.c 2008-02-20 11:43:22.000000000 +0100
> +++ everything/drivers/net/wireless/rndis_wlan.c 2008-02-20 11:45:35.000000000 +0100
> @@ -228,9 +228,9 @@ struct NDIS_WLAN_BSSID_EX {
> struct NDIS_802_11_SSID Ssid;
> __le32 Privacy;
> __le32 Rssi;
> - enum NDIS_802_11_NETWORK_TYPE NetworkTypeInUse;
> + __le32 NetworkTypeInUse;
> struct NDIS_802_11_CONFIGURATION Configuration;
> - enum NDIS_802_11_NETWORK_INFRASTRUCTURE InfrastructureMode;
> + __le32 InfrastructureMode;
> u8 SupportedRates[NDIS_802_11_LENGTH_RATES_EX];
> __le32 IELength;
> u8 IEs[0];
> @@ -279,11 +279,11 @@ struct RNDIS_CONFIG_PARAMETER_INFOBUFFER
> } __attribute__((packed));
>
> /* these have to match what is in wpa_supplicant */
> -enum { WPA_ALG_NONE, WPA_ALG_WEP, WPA_ALG_TKIP, WPA_ALG_CCMP } wpa_alg;
> -enum { CIPHER_NONE, CIPHER_WEP40, CIPHER_TKIP, CIPHER_CCMP, CIPHER_WEP104 }
> - wpa_cipher;
> -enum { KEY_MGMT_802_1X, KEY_MGMT_PSK, KEY_MGMT_NONE, KEY_MGMT_802_1X_NO_WPA,
> - KEY_MGMT_WPA_NONE } wpa_key_mgmt;
> +enum wpa_alg { WPA_ALG_NONE, WPA_ALG_WEP, WPA_ALG_TKIP, WPA_ALG_CCMP };
> +enum wpa_cipher { CIPHER_NONE, CIPHER_WEP40, CIPHER_TKIP, CIPHER_CCMP,
> + CIPHER_WEP104 };
> +enum wpa_key_mgmt { KEY_MGMT_802_1X, KEY_MGMT_PSK, KEY_MGMT_NONE,
> + KEY_MGMT_802_1X_NO_WPA, KEY_MGMT_WPA_NONE };
>
> /*
> * private data
>
>
> -
> 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
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-02-24 11:04 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-20 10:47 [PATCH] rndis_wlan: fix sparse warnings Johannes Berg
2008-02-20 20:20 ` John W. Linville
2008-02-21 9:29 ` Johannes Berg
2008-02-21 16:20 ` John W. Linville
2008-02-24 11:02 ` Jussi Kivilinna
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).