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] [day] [month] [year] [list]
Message-Id: <1288351674.30706.4.camel@4fid08082>
Date:	Fri, 29 Oct 2010 14:27:54 +0300
From:	Onkalo Samu <samu.p.onkalo@...ia.com>
To:	ext Dan Carpenter <error27@...il.com>
Cc:	Jonathan Cameron <jic23@....ac.uk>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"kernel-janitors@...r.kernel.org" <kernel-janitors@...r.kernel.org>
Subject: Re: [patch] misc/bh1770glc: error handling in
 bh1770_power_state_store()

On Thu, 2010-10-28 at 06:41 +0200, ext Dan Carpenter wrote:
> There was a signedness bug so "ret" was never less than zero and that
> breaks the error handling.  Also in the original code it would overwrite
> ret and the result is still negative but it's bogus number instead of
> the correct error code.
> 
> Signed-off-by: Dan Carpenter <error27@...il.com>

Acked-by: Samu Onkalo <samu.p.onkalo@...ia.com>

> 
> diff --git a/drivers/misc/bh1770glc.c b/drivers/misc/bh1770glc.c
> index cee632e..d79a972 100644
> --- a/drivers/misc/bh1770glc.c
> +++ b/drivers/misc/bh1770glc.c
> @@ -649,7 +649,7 @@ static ssize_t bh1770_power_state_store(struct device *dev,
>  {
>  	struct bh1770_chip *chip =  dev_get_drvdata(dev);
>  	unsigned long value;
> -	size_t ret;
> +	ssize_t ret;
>  
>  	if (strict_strtoul(buf, 0, &value))
>  		return -EINVAL;
> @@ -659,8 +659,12 @@ static ssize_t bh1770_power_state_store(struct device *dev,
>  		pm_runtime_get_sync(dev);
>  
>  		ret = bh1770_lux_rate(chip, chip->lux_rate_index);
> -		ret |= bh1770_lux_interrupt_control(chip, BH1770_ENABLE);
> +		if (ret < 0) {
> +			pm_runtime_put(dev);
> +			goto leave;
> +		}
>  
> +		ret = bh1770_lux_interrupt_control(chip, BH1770_ENABLE);
>  		if (ret < 0) {
>  			pm_runtime_put(dev);
>  			goto leave;

--
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