Skip to contentSkip to conversation

staging: rtl8192u: ieee80211: Silence sparse endianness warning

PATCH In review Gaston Gonzalez 3 participants 5 messages May 25, 2015 – May 26, 2015 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: rtl8192u: ieee80211: Silence sparse endianness warning

Silence the following sparse warning:

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 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c +0 -0
index d2e8b12..7dd8442 100644
@@ -660,2 +660,2 @@ 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;
+ auth->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_AUTH);
if (challengelen) auth->header.frame_ctl |= IEEE80211_FCTL_WEP;

auth->header.duration_id = 0x013a; //FIXME
--
2.1.4

#1 lore raw
Quoted 16 lines · Gaston Gonzalez

Silence the following sparse warning:

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 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c +0 -0
index d2e8b12..7dd8442 100644

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

Quoted 6 lines
drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c +1 -1
@@ -660,2 +660,2 @@ 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;
+	auth->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_AUTH);
 	if (challengelen) auth->header.frame_ctl |= IEEE80211_FCTL_WEP;
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

This is also wrong then.

regards,
dan carpenter

#2 lore raw
Quoted 4 lines · Dan Carpenter

This is also wrong then.

regards,
dan carpenter

Hi Dan,

Yes, you are right. It is the next sparse warning in line for that file. Including the fix for that, the patch would be as showed below.

There are similar endianness warnings for other variables in that file, like the FIXME in last line of the patch. But keeping in mind the rule 'one thing per patch' I guess this should be fixed in other patche/s, right?

Regards,

Gaston

(quoted diff) +0 -0

b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c index d2e8b12..0477ba1 100644

drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c +0 -0
@@ -660,2 +660,2 @@ 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

--
2.1.4

#3 lore raw
Quoted 9 lines · Gaston Gonzalez
Quoted 4 lines · Dan Carpenter

This is also wrong then.

regards,
dan carpenter

Hi Dan,

Yes, you are right. It is the next sparse warning in line for that file. Including the fix for that, the patch would be as showed below.

please send a proper patch with proper commit message.

regards
sudip

Quoted 1 line
#4 lore raw
In reply to Gaston Gonzalez

Btw, the subject should say "fix endian bug". "silence" means that their is a warning and possible some messy code but no runtime bug.

Quoted 5 lines · Gaston Gonzalez
Quoted 4 lines · Dan Carpenter

This is also wrong then.

regards,
dan carpenter

Quoted 8 lines

Hi Dan,

Yes, you are right. It is the next sparse warning in line for that file. Including the fix for that, the patch would be as showed below.

There are similar endianness warnings for other variables in that file, like the FIXME in last line of the patch. But keeping in mind the rule 'one thing per patch' I guess this should be fixed in other patche/s, right?

The one thing per patch rule is a bit fuzzy. It depends on how you sell it a bit. I wouldn't mind if you fixed the whole function at once. Or even all then endian bugs in a file if the patch wasn't too complicated.

But this is also acceptable to fix one struct member so send your proposed patch.

regards,
dan carpenter