Skip to contentSkip to conversation

staging: rtl8192u: ieee80211: Fix sparse endianness warnings

PATCH RESEND Superseded Gaston Gonzalez 2 participants 3 messages Jun 1, 2015 Staging

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 staging: rtl8192u: ieee80211: Fix sparse endianness warnings

Fix the following sparse warnings:

drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c:663:32: warning: incorrect type in assignment (different base types)
drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c:663:32: expected restricted __le16 [usertype] frame_ctl
drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c:663:32: got int
drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c:664:50: warning: invalid assignment: |=
drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c:664:50: left side has type restricted __le16
drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c:664:50: right side has type int

---
 drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c +3 -2
index d2e8b12..bda961c 100644
@@ -660,8 +660,9 @@ inline struct sk_buff *ieee80211_authentication_req(struct ieee80211_network *be
 	auth = (struct ieee80211_authentication *)
 		skb_put(skb, sizeof(struct ieee80211_authentication));
 
-	auth->header.frame_ctl = IEEE80211_STYPE_AUTH;
-	if (challengelen) auth->header.frame_ctl |= IEEE80211_FCTL_WEP;
+	auth->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_AUTH);
+	if (challengelen)
+	  auth->header.frame_ctl |= cpu_to_le16(IEEE80211_FCTL_WEP);
 
 	auth->header.duration_id = 0x013a; //FIXME
 
Signature · 1 line
2.1.4
#1 lore raw
Quoted 1 line · Gaston Gonzalez

Fix the following sparse warnings:

[]

drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c

Quoted 1 line
drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c +0 -0

[]

drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c inline struct sk_buff *ieee80211_authentication_req(struct ieee80211_network *be · line 665

Quoted 9 lines
drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c +3 -2
@@ -660,8 +660,9 @@ inline struct sk_buff *ieee80211_authentication_req(struct ieee80211_network *be
 	auth = (struct ieee80211_authentication *)
 		skb_put(skb, sizeof(struct ieee80211_authentication));
 
-	auth->header.frame_ctl = IEEE80211_STYPE_AUTH;
-	if (challengelen) auth->header.frame_ctl |= IEEE80211_FCTL_WEP;
+	auth->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_AUTH);
+	if (challengelen)
+	  auth->header.frame_ctl |= cpu_to_le16(IEEE80211_FCTL_WEP);

It'd be better to use normal tab indentation and likely it'd also be better to set this only once

	if (challengelen)
		auth->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_AUTH | IEEE80211_FCTL_WEP);
	else
		auth->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_AUTH);

or maybe a single line

	auth->header.frame_ctl = cpu_to_le16(challengelen ? IEEE80211_STYPE_AUTH | IEEE80211_FCTL_WEP : IEEE80211_STYPE_AUTH);

though I think the first is simpler to read.

#2 lore raw
Quoted 23 lines · Joe Perches
Quoted 1 line · Gaston Gonzalez

Fix the following sparse warnings:

[]

drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c

Quoted 1 line
drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c +0 -0

[]

drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c inline struct sk_buff *ieee80211_authentication_req(struct ieee80211_network *be · line 665

Quoted 9 lines
drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c +3 -2
@@ -660,8 +660,9 @@ inline struct sk_buff *ieee80211_authentication_req(struct ieee80211_network *be
 	auth = (struct ieee80211_authentication *)
 		skb_put(skb, sizeof(struct ieee80211_authentication));
 
-	auth->header.frame_ctl = IEEE80211_STYPE_AUTH;
-	if (challengelen) auth->header.frame_ctl |= IEEE80211_FCTL_WEP;
+	auth->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_AUTH);
+	if (challengelen)
+	  auth->header.frame_ctl |= cpu_to_le16(IEEE80211_FCTL_WEP);

It'd be better to use normal tab indentation and likely it'd also be better to set this only once

	if (challengelen)
		auth->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_AUTH | IEEE80211_FCTL_WEP);
	else
		auth->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_AUTH);
Quoted 7 lines

or maybe a single line

	auth->header.frame_ctl = cpu_to_le16(challengelen ? IEEE80211_STYPE_AUTH | IEEE80211_FCTL_WEP : IEEE80211_STYPE_AUTH);

though I think the first is simpler to read.

Thanks for the feedback.

I'll send a v2 making the changes according to your first option.

regards,

Gaston