* [PATCH] staging: rtl8192u: Fix type mismatch warnings reported by sparse
@ 2017-05-01 7:49 suniel.spartan
2017-05-12 9:06 ` Greg KH
0 siblings, 1 reply; 5+ messages in thread
From: suniel.spartan @ 2017-05-01 7:49 UTC (permalink / raw)
To: gregkh; +Cc: linux-kernel, devel, sunil.m, Suniel Mahesh
From: Suniel Mahesh <suniel.spartan@gmail.com>
The function Mk16_le() is calling le16_to_cpu() internally.
le16_to_cpu() takes an argument of type (__le *) but the argument
passed is of type (u16 *). Fixed it by passing the correct argument.
Signed-off-by: Suniel Mahesh <suniel.spartan@gmail.com>
---
.../rtl8192u/ieee80211/ieee80211_crypt_tkip.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c
index 5039172..11ddf30 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.9.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH] staging: rtl8192u: Fix type mismatch warnings reported by sparse
@ 2017-05-09 9:47 suniel.spartan
2017-05-12 9:07 ` Greg KH
0 siblings, 1 reply; 5+ messages in thread
From: suniel.spartan @ 2017-05-09 9:47 UTC (permalink / raw)
To: gregkh; +Cc: linux-kernel, devel, sunil.m, Suniel Mahesh
From: Suniel Mahesh <suniel.spartan@gmail.com>
The function Mk16_le() is calling le16_to_cpu()
internally. le16_to_cpu() takes an argument of type (__le *)
but the argument passed is of type (u16 *). Fixed it by passing
the correct argument type.
Signed-off-by: Suniel Mahesh <suniel.spartan@gmail.com>
---
.../rtl8192u/ieee80211/ieee80211_crypt_tkip.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c
index 5039172..11ddf30 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.9.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] staging: rtl8192u: Fix type mismatch warnings reported by sparse
2017-05-01 7:49 [PATCH] staging: rtl8192u: Fix type mismatch warnings reported by sparse suniel.spartan
@ 2017-05-12 9:06 ` Greg KH
2017-05-12 15:46 ` [PATCH v2] " suniel.spartan
0 siblings, 1 reply; 5+ messages in thread
From: Greg KH @ 2017-05-12 9:06 UTC (permalink / raw)
To: suniel.spartan; +Cc: linux-kernel, devel, sunil.m
On Mon, May 01, 2017 at 01:19:24PM +0530, suniel.spartan@gmail.com wrote:
> From: Suniel Mahesh <suniel.spartan@gmail.com>
>
> The function Mk16_le() is calling le16_to_cpu() internally.
> le16_to_cpu() takes an argument of type (__le *) but the argument
> passed is of type (u16 *). Fixed it by passing the correct argument.
>
> Signed-off-by: Suniel Mahesh <suniel.spartan@gmail.com>
> ---
> .../rtl8192u/ieee80211/ieee80211_crypt_tkip.c | 22 +++++++++++-----------
> 1 file changed, 11 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c
> index 5039172..11ddf30 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);
> }
Ick, no, just replace all usages of this function with the "real"
le16_to_cpu() call.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] staging: rtl8192u: Fix type mismatch warnings reported by sparse
2017-05-09 9:47 [PATCH] " suniel.spartan
@ 2017-05-12 9:07 ` Greg KH
0 siblings, 0 replies; 5+ messages in thread
From: Greg KH @ 2017-05-12 9:07 UTC (permalink / raw)
To: suniel.spartan; +Cc: devel, sunil.m, linux-kernel
On Tue, May 09, 2017 at 03:17:56PM +0530, suniel.spartan@gmail.com wrote:
> From: Suniel Mahesh <suniel.spartan@gmail.com>
>
> The function Mk16_le() is calling le16_to_cpu()
> internally. le16_to_cpu() takes an argument of type (__le *)
> but the argument passed is of type (u16 *). Fixed it by passing
> the correct argument type.
>
> Signed-off-by: Suniel Mahesh <suniel.spartan@gmail.com>
> ---
> .../rtl8192u/ieee80211/ieee80211_crypt_tkip.c | 22 +++++++++++-----------
> 1 file changed, 11 insertions(+), 11 deletions(-)
Is this a resend?
> diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c
> index 5039172..11ddf30 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);
> }
Just use the real function here and delete this "odd" one.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2] staging: rtl8192u: Fix type mismatch warnings reported by sparse
2017-05-12 9:06 ` Greg KH
@ 2017-05-12 15:46 ` suniel.spartan
0 siblings, 0 replies; 5+ messages in thread
From: suniel.spartan @ 2017-05-12 15:46 UTC (permalink / raw)
To: gregkh; +Cc: linux-kernel, devel, sunil.m, Suniel Mahesh
From: Suniel Mahesh <suniel.spartan@gmail.com>
Mk16_le() is an inline function returning le16_to_cpu()
which is causing type mismatch warnings. Removed Mk16_le() and
replaced it with le16_to_cpu() with appropriate argument type as
suggested by Greg K-H.
Signed-off-by: Suniel Mahesh <suniel.spartan@gmail.com>
---
Changes for v2:
- Modified commit message, removed Mk16_le() and replaced it with
le16_to_cpu() as suggested by Greg K-H.
- Patches were tested and built on linux-next and staging-testing
---
.../rtl8192u/ieee80211/ieee80211_crypt_tkip.c | 27 ++++++++--------------
1 file changed, 10 insertions(+), 17 deletions(-)
diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c
index 5039172..60ecfec 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c
@@ -171,13 +171,6 @@ static inline u16 Mk16(u8 hi, u8 lo)
return lo | (((u16) hi) << 8);
}
-
-static inline u16 Mk16_le(u16 *v)
-{
- return le16_to_cpu(*v);
-}
-
-
static const u16 Sbox[256] = {
0xC6A5, 0xF884, 0xEE99, 0xF68D, 0xFF0D, 0xD6BD, 0xDEB1, 0x9154,
0x6050, 0x0203, 0xCEA9, 0x567D, 0xE719, 0xB562, 0x4DE6, 0xEC9A,
@@ -264,15 +257,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] ^ le16_to_cpu(*(__le16 *)(&TK[0])));
+ PPK[1] += _S_(PPK[0] ^ le16_to_cpu(*(__le16 *)(&TK[2])));
+ PPK[2] += _S_(PPK[1] ^ le16_to_cpu(*(__le16 *)(&TK[4])));
+ PPK[3] += _S_(PPK[2] ^ le16_to_cpu(*(__le16 *)(&TK[6])));
+ PPK[4] += _S_(PPK[3] ^ le16_to_cpu(*(__le16 *)(&TK[8])));
+ PPK[5] += _S_(PPK[4] ^ le16_to_cpu(*(__le16 *)(&TK[10])));
+
+ PPK[0] += RotR1(PPK[5] ^ le16_to_cpu(*(__le16 *)(&TK[12])));
+ PPK[1] += RotR1(PPK[0] ^ le16_to_cpu(*(__le16 *)(&TK[14])));
PPK[2] += RotR1(PPK[1]);
PPK[3] += RotR1(PPK[2]);
PPK[4] += RotR1(PPK[3]);
@@ -285,7 +278,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] ^ le16_to_cpu(*(__le16 *)(&TK[0]))) >> 1);
#ifdef __BIG_ENDIAN
{
--
1.9.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-05-12 15:47 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-01 7:49 [PATCH] staging: rtl8192u: Fix type mismatch warnings reported by sparse suniel.spartan
2017-05-12 9:06 ` Greg KH
2017-05-12 15:46 ` [PATCH v2] " suniel.spartan
-- strict thread matches above, loose matches on Subject: below --
2017-05-09 9:47 [PATCH] " suniel.spartan
2017-05-12 9:07 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox