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-next>] [day] [month] [year] [list]
Date:	Mon, 4 Jul 2016 14:20:39 +0200
From:	Martin Kepplinger <martink@...teo.de>
To:	Bijosh Thykkoottathil <bijosh.t@...mail.com>,
	"jic23@...nel.org" <jic23@...nel.org>,
	"knaack.h@....de" <knaack.h@....de>,
	"lars@...afoo.de" <lars@...afoo.de>,
	"pmeerw@...erw.net" <pmeerw@...erw.net>,
	"christoph.muellner@...obroma-systems.com" 
	<christoph.muellner@...obroma-systems.com>
Cc:	"linux-iio@...r.kernel.org" <linux-iio@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v1] drivers:iio:accel:mma8452: added cleanup provision in
 case of failure.

Am 2016-07-04 um 12:08 schrieb Bijosh Thykkoottathil:
> mma8452_set_freefall_mode can return -ve value in case if
> i2c_smbus_read_byte_data fails. This function is called from mma8452_probe,
> and returning -ve value from probe indicates probe failure. Need to call
> iio_triggered_buffer_cleanup & iio_trigger_cleanup in this case.

Thanks for your review, nice catch! Looks good to me. You just could
have said "Don't leak allocated buffer on error during probe().", but oh
well :)

> 
> Signed-off-by: Bijosh Thykkoottathil <bijosh.t@...mail.com>
Reviewed-by: Martin Kepplinger <martink@...teo.de>

> ---
>  drivers/iio/accel/mma8452.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/accel/mma8452.c b/drivers/iio/accel/mma8452.c
> index e225d3c..1bcf5c3 100644
> --- a/drivers/iio/accel/mma8452.c
> +++ b/drivers/iio/accel/mma8452.c
> @@ -1444,8 +1444,8 @@ static int mma8452_probe(struct i2c_client *client,
>  		goto buffer_cleanup;
>  
>  	ret = mma8452_set_freefall_mode(data, false);
> -	if (ret)
> -		return ret;
> +	if (ret < 0)
> +		goto buffer_cleanup;
>  
>  	return 0;
>  
> 

Powered by blists - more mailing lists