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: <20120214150455.GN4141@mwanda>
Date:	Tue, 14 Feb 2012 18:04:55 +0300
From:	Dan Carpenter <dan.carpenter@...cle.com>
To:	Danny Kukawka <danny.kukawka@...ect.de>
Cc:	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	devel@...verdev.osuosl.org, Lars-Peter Clausen <lars@...afoo.de>,
	Michael Hennerich <michael.hennerich@...log.com>,
	linux-iio@...r.kernel.org, Danny Kukawka <dkukawka@...e.de>,
	linux-kernel@...r.kernel.org,
	Paul Gortmaker <paul.gortmaker@...driver.com>
Subject: Re: [PATCH] adis16080: fix compiler -Wuninitialized

On Tue, Feb 14, 2012 at 03:35:36PM +0100, Danny Kukawka wrote:
> Fix for:
> drivers/staging/iio/gyro/adis16080_core.c: In function
>   ‘adis16080_read_raw’:
> drivers/staging/iio/gyro/adis16080_core.c:99:8: warning: ‘ut’
>   may be used uninitialized in this function [-Wuninitialized]
> 
> Initialize ut and change error handling from adis16080_read_raw().
> 
> Signed-off-by: Danny Kukawka <danny.kukawka@...ect.de>
> ---
>  drivers/staging/iio/gyro/adis16080_core.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/iio/gyro/adis16080_core.c b/drivers/staging/iio/gyro/adis16080_core.c
> index 1815490..e0b2a29 100644
> --- a/drivers/staging/iio/gyro/adis16080_core.c
> +++ b/drivers/staging/iio/gyro/adis16080_core.c
> @@ -82,7 +82,7 @@ static int adis16080_read_raw(struct iio_dev *indio_dev,
>  			     long mask)
>  {
>  	int ret = -EINVAL;
> -	u16 ut;
> +	u16 ut = 0;
>  	/* Take the iio_dev status lock */
>  
>  	mutex_lock(&indio_dev->mlock);
> @@ -94,7 +94,7 @@ static int adis16080_read_raw(struct iio_dev *indio_dev,
>  		if (ret < 0)
>  			break;
>  		ret = adis16080_spi_read(indio_dev, &ut);
> -		if (ret < 0)
> +		if (ret)
>  			break;

Either one of these changes would silence the warning from gcc
(which is a false positive).  I would keep the "ut = 0;" change and
leave the error handling the same.  That way we check for less than
zero consistently instead of checking some for non-zero and some for
less than zero.

I normally wouldn't have commented on this if the changelog had said
whether it was a gcc false positive or if the code changes the
behavior.  It really should be mentioned.

If you could put a "Staging:" and an "iio" in the subject, that
would be grand as well.  Everyone seems to be using the prefix
"staging:iio:gyro:adis16080" for that file...  I don't know why they
don't just use slashes if they're going to specify the whole file...

regards,
dan carpenter

Download attachment "signature.asc" of type "application/pgp-signature" (837 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ