public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Gaston Gonzalez <gascoar@gmail.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: Mon, 20 Apr 2015 11:24:41 +0300	[thread overview]
Message-ID: <20150420082441.GU10964@mwanda> (raw)
In-Reply-To: <1429476231-6197-1-git-send-email-gascoar@gmail.com>

On Sun, Apr 19, 2015 at 05:43:51PM -0300, Gaston Gonzalez wrote:
> Silence the following sparse warning:
> 
> drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c:184:16: warning: cast to restricted __le16
> 

We have a tkip_mixing_phase2() function in net/mac80211/tkip.c.  That's
probably the better thing.

> Signed-off-by: Gaston Gonzalez <gascoar@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 e815c81..efa6983 100644
> --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c
> +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c
> @@ -179,1 +179,1 @@ 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);
>  }


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.

regards,
dan carpenter


  reply	other threads:[~2015-04-20  8:24 UTC|newest]

Thread overview: 5+ 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 [this message]
2015-04-25 22:44   ` Gaston Gonzalez
2015-04-27 10:12     ` Dan Carpenter
2015-05-07  3:09       ` 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=20150420082441.GU10964@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=arnd@arndb.de \
    --cc=devel@driverdev.osuosl.org \
    --cc=gascoar@gmail.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox