Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1638017 > unrolled thread

[PATCH] staging: rtl8192u: Fix type mismatch warnings reported by sparse

Started bysuniel.spartan@gmail.com
First post2017-05-09 11:50 +0200
Last post2017-05-12 11:10 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] staging: rtl8192u: Fix type mismatch warnings reported by sparse suniel.spartan@gmail.com - 2017-05-09 11:50 +0200
    Re: [PATCH] staging: rtl8192u: Fix type mismatch warnings reported  by sparse Greg KH <gregkh@linuxfoundation.org> - 2017-05-12 11:10 +0200

#1638017 — [PATCH] staging: rtl8192u: Fix type mismatch warnings reported by sparse

Fromsuniel.spartan@gmail.com
Date2017-05-09 11:50 +0200
Subject[PATCH] staging: rtl8192u: Fix type mismatch warnings reported by sparse
Message-ID<tF9Wi-8nt-17@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#1640329 — Re: [PATCH] staging: rtl8192u: Fix type mismatch warnings reported by sparse

FromGreg KH <gregkh@linuxfoundation.org>
Date2017-05-12 11:10 +0200
SubjectRe: [PATCH] staging: rtl8192u: Fix type mismatch warnings reported by sparse
Message-ID<tGeKd-2eI-9@gated-at.bofh.it>
In reply to#1638017
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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web