* [PATCH] staging: rtl8192u: Fix warnings about endianness
@ 2017-02-15 10:21 maomao xu
0 siblings, 0 replies; 8+ messages in thread
From: maomao xu @ 2017-02-15 10:21 UTC (permalink / raw)
To: gregkh, bhumirks, singhalsimran0, nikolas, bhaktipriya96,
elise.lennion, albert008.xu, devel, linux-kernel
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>
Signed-off-by: maomao xu <albert008.xu@gmail.com>
diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c
index d1057b1..1e81c24 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c
@@ -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, skb_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);
}
--
1.7.9.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] staging: rtl8192u: Fix warnings about endianness
2017-02-15 20:31 ` Dan Carpenter
@ 2017-02-18 3:55 ` maomao
0 siblings, 0 replies; 8+ messages in thread
From: maomao @ 2017-02-18 3:55 UTC (permalink / raw)
To: Dan Carpenter, Arnd Bergmann
Cc: devel, gregkh, Peter P Waskiewicz Jr, Linux Kernel Mailing List,
Rashika Kheria, singhalsimran0
On February 16, 2017 4:31:16 AM GMT+08:00, Dan Carpenter <dan.carpenter@oracle.com> wrote:
>On Wed, Feb 15, 2017 at 09:33:15AM +0100, Arnd Bergmann wrote:
>> I see the same warning was addressed very differently in 99277c1f9962
>> ("Staging: rtl8192e: Fix Sparse warning of cast to restricted __le16
>in
>> rtllib_crypt_tkip.c"), which was for a close relative of that
>driver.
>>
>> Only one of the two approaches (at most) can be correct, so we
>> regardless of your patch either rtl8192e or rtl8192u is broken on
>> big-endian machines.
>
>99277c1f9962 ("Staging: rtl8192e: Fix Sparse warning of cast to
>restricted __le16 in
>rtllib_crypt_tkip.c") is obviously broken. Can you send a patch to
>change it back?
>
>regards,
>dan carpenter
yes,I have done.But I have receive nothing about this patch from lkml for days
--
Sent from Kaiten Mail. Please excuse my brevity.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] staging: rtl8192u: Fix warnings about endianness
2017-02-15 9:06 maomao xu
2017-02-15 9:44 ` kbuild test robot
@ 2017-02-16 18:43 ` Greg KH
1 sibling, 0 replies; 8+ messages in thread
From: Greg KH @ 2017-02-16 18:43 UTC (permalink / raw)
To: maomao xu
Cc: bhumirks, singhalsimran0, nikolas, bhaktipriya96, elise.lennion,
devel, linux-kernel
On Wed, Feb 15, 2017 at 05:06:27PM +0800, maomao xu wrote:
> 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>
>
> Signed-off-by: maomao xu <albert008.xu@gmail.com>
>
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
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] staging: rtl8192u: Fix warnings about endianness
2017-02-15 8:33 ` Arnd Bergmann
@ 2017-02-15 20:31 ` Dan Carpenter
2017-02-18 3:55 ` maomao
0 siblings, 1 reply; 8+ messages in thread
From: Dan Carpenter @ 2017-02-15 20:31 UTC (permalink / raw)
To: Arnd Bergmann
Cc: maomao xu, devel, gregkh, Peter P Waskiewicz Jr,
Linux Kernel Mailing List, Rashika Kheria, singhalsimran0
On Wed, Feb 15, 2017 at 09:33:15AM +0100, Arnd Bergmann wrote:
> I see the same warning was addressed very differently in 99277c1f9962
> ("Staging: rtl8192e: Fix Sparse warning of cast to restricted __le16 in
> rtllib_crypt_tkip.c"), which was for a close relative of that driver.
>
> Only one of the two approaches (at most) can be correct, so we
> regardless of your patch either rtl8192e or rtl8192u is broken on
> big-endian machines.
99277c1f9962 ("Staging: rtl8192e: Fix Sparse warning of cast to restricted __le16 in
rtllib_crypt_tkip.c") is obviously broken. Can you send a patch to
change it back?
regards,
dan carpenter
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] staging: rtl8192u: Fix warnings about endianness
2017-02-15 9:06 maomao xu
@ 2017-02-15 9:44 ` kbuild test robot
2017-02-16 18:43 ` Greg KH
1 sibling, 0 replies; 8+ messages in thread
From: kbuild test robot @ 2017-02-15 9:44 UTC (permalink / raw)
To: maomao xu
Cc: kbuild-all, gregkh, bhumirks, singhalsimran0, nikolas,
bhaktipriya96, elise.lennion, albert008.xu, devel, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 2330 bytes --]
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
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 24805 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH] staging: rtl8192u: Fix warnings about endianness
@ 2017-02-15 9:06 maomao xu
2017-02-15 9:44 ` kbuild test robot
2017-02-16 18:43 ` Greg KH
0 siblings, 2 replies; 8+ messages in thread
From: maomao xu @ 2017-02-15 9:06 UTC (permalink / raw)
To: gregkh, bhumirks, singhalsimran0, nikolas, bhaktipriya96,
elise.lennion, albert008.xu, devel, linux-kernel
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>
Signed-off-by: maomao xu <albert008.xu@gmail.com>
diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c
index d1057b1..1e81c24 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c
@@ -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);
}
--
1.7.9.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] staging: rtl8192u: Fix warnings about endianness
2017-02-15 7:54 maomao xu
@ 2017-02-15 8:33 ` Arnd Bergmann
2017-02-15 20:31 ` Dan Carpenter
0 siblings, 1 reply; 8+ messages in thread
From: Arnd Bergmann @ 2017-02-15 8:33 UTC (permalink / raw)
To: maomao xu
Cc: gregkh, singhalsimran0, devel, Linux Kernel Mailing List,
Rashika Kheria, Peter P Waskiewicz Jr
On Wed, Feb 15, 2017 at 8:54 AM, maomao xu <albert008.xu@gmail.com> wrote:
> drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c:177:16: warning: cast to restricted __le16
> drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c:177:16: warning: cast to restricted __le16
> drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c:177:16: warning: cast to restricted __le16
> drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c:177:16: warning: cast to restricted __le16
> drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c:177:16: warning: cast to restricted __le16
> drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c:177:16: warning: cast to restricted __le16
> drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c:177:16: warning: cast to restricted __le16
> drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c:177:16: warning: cast to restricted __le16
> drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c:177:16: warning: cast to restricted __le16
>
> Signed-off-by: maomao xu <albert008.xu@gmail.com>
>
> diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c
> index 2453413..fb171bd 100644
> --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c
> +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c
> @@ -172,7 +172,7 @@ static inline u16 Mk16(u8 hi, u8 lo)
> }
>
>
> -static inline u16 Mk16_le(u16 *v)
> +static inline u16 Mk16_le(__le16 *v)
> {
> return le16_to_cpu(*v);
> }
> @@ -264,15 +264,15 @@ static void tkip_mixing_phase2(u8 *WEPSeed, const u8 *TK, const u16 *TTAK,
> PPK[5] = TTAK[4] + IV16;
>
> /* Step 2 - 96-bit bijective mixing using S-box */
> - PPK[0] += _S_(PPK[5] ^ Mk16_le((u16 *) &TK[0]));
> - PPK[1] += _S_(PPK[0] ^ Mk16_le((u16 *) &TK[2]));
> - PPK[2] += _S_(PPK[1] ^ Mk16_le((u16 *) &TK[4]));
> - PPK[3] += _S_(PPK[2] ^ Mk16_le((u16 *) &TK[6]));
> - PPK[4] += _S_(PPK[3] ^ Mk16_le((u16 *) &TK[8]));
> - PPK[5] += _S_(PPK[4] ^ Mk16_le((u16 *) &TK[10]));
> -
> - PPK[0] += RotR1(PPK[5] ^ Mk16_le((u16 *) &TK[12]));
> - PPK[1] += RotR1(PPK[0] ^ Mk16_le((u16 *) &TK[14]));
> + PPK[0] += _S_(PPK[5] ^ Mk16_le((__le16 *) &TK[0]));
> + PPK[1] += _S_(PPK[0] ^ Mk16_le((__le16 *) &TK[2]));
> + PPK[2] += _S_(PPK[1] ^ Mk16_le((__le16 *) &TK[4]));
> + PPK[3] += _S_(PPK[2] ^ Mk16_le((__le16 *) &TK[6]));
> + PPK[4] += _S_(PPK[3] ^ Mk16_le((__le16 *) &TK[8]));
> + PPK[5] += _S_(PPK[4] ^ Mk16_le((__le16 *) &TK[10]));
> +
> + PPK[0] += RotR1(PPK[5] ^ Mk16_le((__le16 *) &TK[12]));
> + PPK[1] += RotR1(PPK[0] ^ Mk16_le((__le16 *) &TK[14]));
> PPK[2] += RotR1(PPK[1]);
> PPK[3] += RotR1(PPK[2]);
> PPK[4] += RotR1(PPK[3]);
> @@ -285,7 +285,7 @@ static void tkip_mixing_phase2(u8 *WEPSeed, const u8 *TK, const u16 *TTAK,
> WEPSeed[0] = Hi8(IV16);
> WEPSeed[1] = (Hi8(IV16) | 0x20) & 0x7F;
> WEPSeed[2] = Lo8(IV16);
> - WEPSeed[3] = Lo8((PPK[5] ^ Mk16_le((u16 *) &TK[0])) >> 1);
> + WEPSeed[3] = Lo8((PPK[5] ^ Mk16_le((__le16 *) &TK[0])) >> 1);
>
> #ifdef __BIG_ENDIAN
> {
I see the same warning was addressed very differently in 99277c1f9962
("Staging: rtl8192e: Fix Sparse warning of cast to restricted __le16 in
rtllib_crypt_tkip.c"), which was for a close relative of that driver.
Only one of the two approaches (at most) can be correct, so we
regardless of your patch either rtl8192e or rtl8192u is broken on
big-endian machines.
I suspect rtl8192e is broken, and your patch is relatively harmless
(we could debate whether it is the cleanest approach, but it doesn't
change behavior and it avoids the warning), but maybe Peter
Waskiewicz knows something about the tkip algorithm that I don't
see.
Arnd
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH] staging: rtl8192u: Fix warnings about endianness
@ 2017-02-15 7:54 maomao xu
2017-02-15 8:33 ` Arnd Bergmann
0 siblings, 1 reply; 8+ messages in thread
From: maomao xu @ 2017-02-15 7:54 UTC (permalink / raw)
To: gregkh, singhalsimran0, arnd, albert008.xu, devel, linux-kernel
drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c:177:16: warning: cast to restricted __le16
drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c:177:16: warning: cast to restricted __le16
drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c:177:16: warning: cast to restricted __le16
drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c:177:16: warning: cast to restricted __le16
drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c:177:16: warning: cast to restricted __le16
drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c:177:16: warning: cast to restricted __le16
drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c:177:16: warning: cast to restricted __le16
drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c:177:16: warning: cast to restricted __le16
drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c:177:16: warning: cast to restricted __le16
Signed-off-by: maomao xu <albert008.xu@gmail.com>
diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c
index 2453413..fb171bd 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c
@@ -172,7 +172,7 @@ static inline u16 Mk16(u8 hi, u8 lo)
}
-static inline u16 Mk16_le(u16 *v)
+static inline u16 Mk16_le(__le16 *v)
{
return le16_to_cpu(*v);
}
@@ -264,15 +264,15 @@ static void tkip_mixing_phase2(u8 *WEPSeed, const u8 *TK, const u16 *TTAK,
PPK[5] = TTAK[4] + IV16;
/* Step 2 - 96-bit bijective mixing using S-box */
- PPK[0] += _S_(PPK[5] ^ Mk16_le((u16 *) &TK[0]));
- PPK[1] += _S_(PPK[0] ^ Mk16_le((u16 *) &TK[2]));
- PPK[2] += _S_(PPK[1] ^ Mk16_le((u16 *) &TK[4]));
- PPK[3] += _S_(PPK[2] ^ Mk16_le((u16 *) &TK[6]));
- PPK[4] += _S_(PPK[3] ^ Mk16_le((u16 *) &TK[8]));
- PPK[5] += _S_(PPK[4] ^ Mk16_le((u16 *) &TK[10]));
-
- PPK[0] += RotR1(PPK[5] ^ Mk16_le((u16 *) &TK[12]));
- PPK[1] += RotR1(PPK[0] ^ Mk16_le((u16 *) &TK[14]));
+ PPK[0] += _S_(PPK[5] ^ Mk16_le((__le16 *) &TK[0]));
+ PPK[1] += _S_(PPK[0] ^ Mk16_le((__le16 *) &TK[2]));
+ PPK[2] += _S_(PPK[1] ^ Mk16_le((__le16 *) &TK[4]));
+ PPK[3] += _S_(PPK[2] ^ Mk16_le((__le16 *) &TK[6]));
+ PPK[4] += _S_(PPK[3] ^ Mk16_le((__le16 *) &TK[8]));
+ PPK[5] += _S_(PPK[4] ^ Mk16_le((__le16 *) &TK[10]));
+
+ PPK[0] += RotR1(PPK[5] ^ Mk16_le((__le16 *) &TK[12]));
+ PPK[1] += RotR1(PPK[0] ^ Mk16_le((__le16 *) &TK[14]));
PPK[2] += RotR1(PPK[1]);
PPK[3] += RotR1(PPK[2]);
PPK[4] += RotR1(PPK[3]);
@@ -285,7 +285,7 @@ static void tkip_mixing_phase2(u8 *WEPSeed, const u8 *TK, const u16 *TTAK,
WEPSeed[0] = Hi8(IV16);
WEPSeed[1] = (Hi8(IV16) | 0x20) & 0x7F;
WEPSeed[2] = Lo8(IV16);
- WEPSeed[3] = Lo8((PPK[5] ^ Mk16_le((u16 *) &TK[0])) >> 1);
+ WEPSeed[3] = Lo8((PPK[5] ^ Mk16_le((__le16 *) &TK[0])) >> 1);
#ifdef __BIG_ENDIAN
{
--
1.7.9.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
end of thread, other threads:[~2017-02-18 4:02 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-15 10:21 [PATCH] staging: rtl8192u: Fix warnings about endianness maomao xu
-- strict thread matches above, loose matches on Subject: below --
2017-02-15 9:06 maomao xu
2017-02-15 9:44 ` kbuild test robot
2017-02-16 18:43 ` Greg KH
2017-02-15 7:54 maomao xu
2017-02-15 8:33 ` Arnd Bergmann
2017-02-15 20:31 ` Dan Carpenter
2017-02-18 3:55 ` maomao
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).