public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Jesper Juhl <jj@chaosbits.net>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	devel@driverdev.osuosl.org,
	Marcos Paulo de Souza <marcos.mage@gmail.com>,
	Forest Bond <forest@alittletooquiet.net>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging: vt6656: Correct a few assignments to be compares in iwctl_siwencodeext()
Date: Sun, 24 Jun 2012 15:08:53 +0300	[thread overview]
Message-ID: <20120624120853.GH5333@mwanda> (raw)
In-Reply-To: <alpine.LNX.2.00.1206220225000.7671@swampdragon.chaosbits.net>

On Fri, Jun 22, 2012 at 02:28:12AM +0200, Jesper Juhl wrote:
> The result of "foo = bar" is true, so in statements such as
>   ...
>   if((pDevice->bwextstep0 = TRUE)&&(param->u.wpa_key.key_index ==1))
>   ...
> an assignment  is most likely not what was intended - a comparison was. As in:
>   ...
>   if ((pDevice->bwextstep0 == TRUE) && (param->u.wpa_key.key_index == 1))
>   ...
> 
> There are a 3 such mistakes in the iwctl_siwencodeext() function.
> This patch fixes them all.
> 
> Signed-off-by: Jesper Juhl <jj@chaosbits.net>
> ---
>  drivers/staging/vt6656/iwctl.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
>   The file could also do with a serious style cleanup, but that's a 
>   different (set of) patches. This one just fixes the bug.
> 
> diff --git a/drivers/staging/vt6656/iwctl.c b/drivers/staging/vt6656/iwctl.c
> index b24e531..5740438 100644
> --- a/drivers/staging/vt6656/iwctl.c
> +++ b/drivers/staging/vt6656/iwctl.c
> @@ -1708,15 +1708,15 @@ if(param->u.wpa_key.alg_name == WPA_ALG_NONE) {
>     if(param->u.wpa_key.key_index ==0) {
>       pDevice->bwextstep0 = TRUE;
>      }
> -   if((pDevice->bwextstep0 = TRUE)&&(param->u.wpa_key.key_index ==1)) {
> +   if ((pDevice->bwextstep0 == TRUE) && (param->u.wpa_key.key_index == 1)) {

Good catch.

GCC would have warned about this bug except that the author tried to
program it in lisp and added stupid extra paranthesis through out.

regards,
dan carpenter



      reply	other threads:[~2012-06-24 12:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-22  0:28 [PATCH] staging: vt6656: Correct a few assignments to be compares in iwctl_siwencodeext() Jesper Juhl
2012-06-24 12: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=20120624120853.GH5333@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=forest@alittletooquiet.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=jj@chaosbits.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcos.mage@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