* [PATCH] staging: vt6656: Correct a few assignments to be compares in iwctl_siwencodeext()
@ 2012-06-22 0:28 Jesper Juhl
2012-06-24 12:08 ` Dan Carpenter
0 siblings, 1 reply; 2+ messages in thread
From: Jesper Juhl @ 2012-06-22 0:28 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Forest Bond, Marcos Paulo de Souza, devel, linux-kernel
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)) {
pDevice->bwextstep0 = FALSE;
pDevice->bwextstep1 = TRUE;
}
- if((pDevice->bwextstep1 = TRUE)&&(param->u.wpa_key.key_index ==2)) {
+ if ((pDevice->bwextstep1 == TRUE) && (param->u.wpa_key.key_index == 2)) {
pDevice->bwextstep1 = FALSE;
pDevice->bwextstep2 = TRUE;
}
- if((pDevice->bwextstep2 = TRUE)&&(param->u.wpa_key.key_index ==3)) {
+ if ((pDevice->bwextstep2 == TRUE)&&(param->u.wpa_key.key_index == 3)) {
pDevice->bwextstep2 = FALSE;
pDevice->bwextstep3 = TRUE;
}
--
1.7.11
--
Jesper Juhl <jj@chaosbits.net> http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] staging: vt6656: Correct a few assignments to be compares in iwctl_siwencodeext()
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
0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2012-06-24 12:08 UTC (permalink / raw)
To: Jesper Juhl
Cc: Greg Kroah-Hartman, devel, Marcos Paulo de Souza, Forest Bond,
linux-kernel
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-06-24 12:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox