Skip to contentSkip to conversation

staging: rtl8192u: Fix warnings about endianness

PATCH In review maomao xu 3 participants 3 messages Feb 15, 2017 – Feb 16, 2017 Staging

lore
Share & tools
lore

maomao xu

author
#0 lore raw

PATCH 1/1 staging: rtl8192u: Fix warnings about endianness

drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c:564:37: warning: incorrect type in assignment (different base types)
drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c:564:37: expected unsigned short [unsigned] [usertype] len
drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c:564:37: got restricted __be16 [usertype] <noident>

drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c +1 -3
index d1057b1..1e81c24 100644
@@ -559,10 +559,8 @@ void ieee80211_indicate_packets(struct ieee80211_device *ieee, struct ieee80211_
 				memcpy(skb_push(sub_skb, ETH_ALEN), prxb->src, ETH_ALEN);
 				memcpy(skb_push(sub_skb, ETH_ALEN), prxb->dst, ETH_ALEN);
 			} else {
-				u16 len;
 			/* Leave Ethernet header part of hdr and full payload */
-				len = htons(sub_skb->len);
-				memcpy(skb_push(sub_skb, 2), &len, 2);
+				put_unaligned_be16(sub_skb->len, kb_push(sub_skb, 2));
 				memcpy(skb_push(sub_skb, ETH_ALEN), prxb->src, ETH_ALEN);
 				memcpy(skb_push(sub_skb, ETH_ALEN), prxb->dst, ETH_ALEN);
 			}
Signature · 1 line
1.7.9.5
#1 lore raw
url: https://github.com/0day-ci/linux/commits/maomao-xu/staging-rtl8192u-Fix-warnings-about-endianness/20170215-171426 config: x86_64-randconfig-x019-201707 (attached as .config) compiler: gcc-6…

Hi maomao,

[auto build test ERROR on staging/staging-testing]
[also build test ERROR on v4.10-rc8 next-20170215]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/maomao-xu/staging-rtl8192u-Fix-warnings-about-endianness/20170215-171426
config: x86_64-randconfig-x019-201707 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901 reproduce:

        # save the attached .config to linux build tree
        make ARCH=x86_64 

All error/warnings (new ones prefixed by >>):

drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c: In function 'ieee80211_indicate_packets':

>> drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c:563:38: error: implicit declaration of function 'kb_push' [-Werror=implicit-function-declaration]
        put_unaligned_be16(sub_skb->len, kb_push(sub_skb, 2));
                                         ^~~~~~~
>> drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c:563:38: warning: passing argument 2 of 'put_unaligned_be16' makes pointer from integer without a cast [-Wint-conversion]
   In file included from arch/x86/include/asm/unaligned.h:8:0,
                    from include/linux/etherdevice.h:28,
                    from drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c:40:

include/linux/unaligned/access_ok.h:52:29: note: expected 'void *' but argument is of type 'int'
static __always_inline void put_unaligned_be16(u16 val, void *p)
^~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors

vim +/kb_push +563 drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c

557 * replace EtherType */
558 skb_pull(sub_skb, SNAP_SIZE);
559 memcpy(skb_push(sub_skb, ETH_ALEN), prxb->src, ETH_ALEN);
560 memcpy(skb_push(sub_skb, ETH_ALEN), prxb->dst, ETH_ALEN);
561 } else {
562 /* Leave Ethernet header part of hdr and full payload */

 > 563					put_unaligned_be16(sub_skb->len, kb_push(sub_skb, 2));

564 memcpy(skb_push(sub_skb, ETH_ALEN), prxb->src, ETH_ALEN);
565 memcpy(skb_push(sub_skb, ETH_ALEN), prxb->dst, ETH_ALEN);
566 }

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

maintainer
#2 lore raw
In reply to maomao xu
Quoted 6 lines · maomao xu

drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c:564:37: warning: incorrect type in assignment (different base types)
drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c:564:37: expected unsigned short [unsigned] [usertype] len
drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c:564:37: got restricted __be16 [usertype] <noident>

Always test-build your patches!!!

I don't know what to apply here at all. Please fix them up and resend a patch series of the correct patches.

thanks,

greg k-h