lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20071017204508.GA32110@kos.to>
Date:	Wed, 17 Oct 2007 23:45:08 +0300
From:	Riku Voipio <riku.voipio@....fi>
To:	Adrian Bunk <bunk@...nel.org>
Cc:	"Mark M. Hoffman" <mhoffman@...htlink.com>,
	lm-sensors@...sensors.org, linux-kernel@...r.kernel.org
Subject: Re: hwmon/f75375s.c: buggy if()

> <--  snip  -->
> 
> ...
> static ssize_t set_pwm_mode(struct device *dev, struct device_attribute *attr,
>                 const char *buf, size_t count)
> {
> ...
>         if (val != 0 || val != 1 || data->kind == f75373)
>                 return -EINVAL;
> ...
> 
> <--  snip  -->

> I'm not sure what exactly was intended, but it was for sure not intended 
> to always return -EINVAL...

Aiee. val should be 1 or 0, and kind must not be f75373.

Signed-off-by: Riku Voipio <riku.voipio@....fi>
---
 drivers/hwmon/f75375s.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/hwmon/f75375s.c b/drivers/hwmon/f75375s.c
index f1df57a..885bfe9 100644
--- a/drivers/hwmon/f75375s.c
+++ b/drivers/hwmon/f75375s.c
@@ -344,7 +344,7 @@ static ssize_t set_pwm_mode(struct device *dev, struct device_attribute *attr,
    int val = simple_strtoul(buf, NULL, 10);
    u8 conf = 0;

-   if (val != 0 || val != 1 || data->kind == f75373)
+   if (!(val == 0 || val == 1 ) || data->kind == f75373)
        return -EINVAL;

    mutex_lock(&data->update_lock);
--
1.5.3.1

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ