From: Gaston Gonzalez <gascoar@gmail.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: gregkh@linuxfoundation.org, navyasri.tech@gmail.com,
joe@perches.com, arnd@arndb.de, devel@driverdev.osuosl.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging: rtl8192u: ieee80211: Silence sparse warning
Date: Sat, 25 Apr 2015 19:44:06 -0300 [thread overview]
Message-ID: <553C18B6.807@gmail.com> (raw)
In-Reply-To: <20150420082441.GU10964@mwanda>
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));
next prev parent reply other threads:[~2015-04-25 22:45 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-19 20:43 [PATCH] staging: rtl8192u: ieee80211: Silence sparse warning Gaston Gonzalez
2015-04-20 8:24 ` Dan Carpenter
2015-04-25 22:44 ` Gaston Gonzalez [this message]
2015-04-27 10:12 ` Dan Carpenter
2015-05-07 3:09 ` Gaston Gonzalez
2015-05-08 11:03 ` Dan Carpenter
2015-05-12 22:23 ` Gaston Gonzalez
2015-05-12 23:11 ` Julian Calaby
2015-05-13 8:36 ` Dan Carpenter
2015-05-14 1:04 ` Gaston Gonzalez
2015-05-14 8:30 ` Dan Carpenter
2015-05-14 19:35 ` Johannes Berg
2015-05-14 19:51 ` Dan Carpenter
2015-05-14 20:01 ` Larry Finger
2015-05-14 22:03 ` Gaston Gonzalez
2015-05-15 7:26 ` Johannes Berg
2015-05-15 20:47 ` Gaston Gonzalez
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=553C18B6.807@gmail.com \
--to=gascoar@gmail.com \
--cc=arnd@arndb.de \
--cc=dan.carpenter@oracle.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=joe@perches.com \
--cc=linux-kernel@vger.kernel.org \
--cc=navyasri.tech@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.