[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <553C18B6.807@gmail.com>
Date: Sat, 25 Apr 2015 19:44:06 -0300
From: Gaston Gonzalez <gascoar@...il.com>
To: Dan Carpenter <dan.carpenter@...cle.com>
CC: gregkh@...uxfoundation.org, navyasri.tech@...il.com,
joe@...ches.com, arnd@...db.de, devel@...verdev.osuosl.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] staging: rtl8192u: ieee80211: Silence sparse warning
On 20/04/15 05:24, Dan Carpenter wrote:
> Mk16_le() is a bad function name and as we can see from tkip.c it just
> duplicates get_unaligned_le16(). Better to make TK void pointer instead
> of a u8 pointer (because it doesn't point to u8s so we have to cast it
> every time we use it). This is another trick I learned from tkip.c.
Ok. Could I just remove Mk16_le() and use get_unaligned_le16() instead?
I built rtl8192u/ using get_unaligned_le16() for the following lines and
I didn't get any warning:
+#include <asm/unaligned.h>
- PPK[0] += _S_(PPK[5] ^ Mk16_le((u16 *) &TK[0]));
- 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] ^ get_unaligned_le16(TK + 0));
+ PPK[1] += _S_(PPK[0] ^ get_unaligned_le16(TK + 2));
+ PPK[2] += _S_(PPK[1] ^ get_unaligned_le16(TK + 4));
+ PPK[3] += _S_(PPK[2] ^ get_unaligned_le16(TK + 6));
+ PPK[4] += _S_(PPK[3] ^ get_unaligned_le16(TK + 8));
+ PPK[5] += _S_(PPK[4] ^ get_unaligned_le16(TK + 10));
+
+ PPK[0] += RotR1(PPK[5] ^ get_unaligned_le16(TK + 12));
+ PPK[1] += RotR1(PPK[0] ^ get_unaligned_le16(TK + 14));
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists