public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Colin Ian King <colin.king@canonical.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jerry Chuang <jerry-chuang@realtek.com>,
	John Whitmore <johnfwhitmore@gmail.com>,
	devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: Re: Added Realtek rtl8192u driver to staging - static analysis report.
Date: Thu, 22 Aug 2019 11:08:48 +0300	[thread overview]
Message-ID: <20190822080848.GF4451@kadam> (raw)
In-Reply-To: <cb1222a8-4c67-8fac-f1d9-755e97699caa@canonical.com>

On Wed, Aug 21, 2019 at 07:18:39PM +0100, Colin Ian King wrote:
> Hi,
> 
> Static analysis of linux-next picked up an issue with the following commit:
> 
> commit 8fc8598e61f6f384f3eaf1d9b09500c12af47b37
> Author: Jerry Chuang <jerry-chuang@realtek.com>
> Date:   Tue Nov 3 07:17:11 2009 -0200
> 
>     Staging: Added Realtek rtl8192u driver to staging
> 
> In drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c we have:
> 
> CID 48331 (#1 of 1): Unused value (UNUSED_VALUE) assigned_pointer
> 
> Assigning value from ieee->crypt[ieee->tx_keyidx] to crypt here, but
> that stored value is not used.
> 
> 746        crypt = ieee->crypt[ieee->tx_keyidx];
> 747        if (encrypt)
> 748                beacon_buf->capability |=
> cpu_to_le16(WLAN_CAPABILITY_PRIVACY);

Earlir in the function we have:

   695          crypt = ieee->crypt[ieee->tx_keyidx];
   696  
   697          encrypt = ieee->host_encrypt && crypt && crypt->ops &&
   698                  ((0 == strcmp(crypt->ops->name, "WEP") || wpa_ie_len));
   699          /* HT ralated element */

So the "crypt" assignment is dublicate and should definitely be removed.
The "if (encrypt) " check looks correct and it sort of matches what we
do in ieee80211_assoc_resp().

   840          encrypt = crypt && crypt->ops;
   841  
   842          if (encrypt)
   843                  assoc->capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY);
   844  

So let's leave it as-is, just delete the crypt assignment.  If you want,
you can send this patch and I can give you a Reviewed-by tag or if you
want I can send the patch and give you Reported-by credit.

regards,
dan carpenter


      parent reply	other threads:[~2019-08-22  8:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-21 18:18 Added Realtek rtl8192u driver to staging - static analysis report Colin Ian King
2019-08-21 20:55 ` Greg Kroah-Hartman
2019-08-21 21:56   ` stephen
2019-08-22  8:08 ` Dan Carpenter [this message]

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=20190822080848.GF4451@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=colin.king@canonical.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jerry-chuang@realtek.com \
    --cc=johnfwhitmore@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /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