* [PATCH] Revert "platform/x86/toshiba-apci.c possible bad if test?"
@ 2014-08-20 17:03 Ari Sundholm
2014-08-20 17:31 ` Valdis.Kletnieks
2014-08-20 18:16 ` Ari Sundholm
0 siblings, 2 replies; 3+ messages in thread
From: Ari Sundholm @ 2014-08-20 17:03 UTC (permalink / raw)
To: platform-driver-x86; +Cc: linux-kernel, Matthew Garrett
From: Ari Sundholm <ari@tuxera.com>
This reverts commit bdc3ae7221213963f438faeaa69c8b4a2195f491.
Signed-off-by: Ari Sundholm <ari@tuxera.com>
---
drivers/platform/x86/toshiba_acpi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c
index e4da61b..b062d3d 100644
--- a/drivers/platform/x86/toshiba_acpi.c
+++ b/drivers/platform/x86/toshiba_acpi.c
@@ -1258,7 +1258,7 @@ static ssize_t toshiba_kbd_bl_mode_store(struct device *dev,
int mode = -1;
int time = -1;
- if (sscanf(buf, "%i", &mode) != 1 || (mode != 2 || mode != 1))
+ if (sscanf(buf, "%i", &mode) != 1 && (mode != 2 || mode != 1))
return -EINVAL;
/* Set the Keyboard Backlight Mode where:
--
1.9.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Revert "platform/x86/toshiba-apci.c possible bad if test?"
2014-08-20 17:03 [PATCH] Revert "platform/x86/toshiba-apci.c possible bad if test?" Ari Sundholm
@ 2014-08-20 17:31 ` Valdis.Kletnieks
2014-08-20 18:16 ` Ari Sundholm
1 sibling, 0 replies; 3+ messages in thread
From: Valdis.Kletnieks @ 2014-08-20 17:31 UTC (permalink / raw)
To: Ari Sundholm; +Cc: platform-driver-x86, linux-kernel, Matthew Garrett
[-- Attachment #1: Type: text/plain, Size: 493 bytes --]
On Wed, 20 Aug 2014 20:03:26 +0300, Ari Sundholm said:
> From: Ari Sundholm <ari@tuxera.com>
>
> This reverts commit bdc3ae7221213963f438faeaa69c8b4a2195f491.
> + if (sscanf(buf, "%i", &mode) != 1 && (mode != 2 || mode != 1))
> return -EINVAL;
I'm not convinced that's right either. If we come in and mode == 1, then
the mode != 2 is true, and yoinks...
I think this wanted to be sscanf() != 1 || ! (mode == 2 || mode == 1)
I'll spin a patch against the reverted version if desired.
[-- Attachment #2: Type: application/pgp-signature, Size: 848 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Revert "platform/x86/toshiba-apci.c possible bad if test?"
2014-08-20 17:03 [PATCH] Revert "platform/x86/toshiba-apci.c possible bad if test?" Ari Sundholm
2014-08-20 17:31 ` Valdis.Kletnieks
@ 2014-08-20 18:16 ` Ari Sundholm
1 sibling, 0 replies; 3+ messages in thread
From: Ari Sundholm @ 2014-08-20 18:16 UTC (permalink / raw)
To: platform-driver-x86; +Cc: linux-kernel, Matthew Garrett
On Wed, 20 Aug 2014, Ari Sundholm wrote:
> - if (sscanf(buf, "%i", &mode) != 1 || (mode != 2 || mode != 1))
> + if (sscanf(buf, "%i", &mode) != 1 && (mode != 2 || mode != 1))
> return -EINVAL;
Note that the condition still looks wrong even after the revert, as
(mode != 2 || mode != 1) is always true. Anybody guess what the actual
intent was?
Best regards,
Ari Sundholm
asundhol@cs.hut.fi
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-08-20 18:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-20 17:03 [PATCH] Revert "platform/x86/toshiba-apci.c possible bad if test?" Ari Sundholm
2014-08-20 17:31 ` Valdis.Kletnieks
2014-08-20 18:16 ` Ari Sundholm
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®