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]
Date:   Tue, 5 May 2020 15:41:25 +0000
From:   "Ardelean, Alexandru" <alexandru.Ardelean@...log.com>
To:     "Hennerich, Michael" <Michael.Hennerich@...log.com>,
        "jic23@...nel.org" <jic23@...nel.org>,
        "lars@...afoo.de" <lars@...afoo.de>,
        "beniamin.bia@...log.com" <beniamin.bia@...log.com>,
        "arnd@...db.de" <arnd@...db.de>,
        "Bogdan, Dragos" <Dragos.Bogdan@...log.com>
CC:     "Jonathan.Cameron@...wei.com" <Jonathan.Cameron@...wei.com>,
        "clang-built-linux@...glegroups.com" 
        <clang-built-linux@...glegroups.com>,
        "knaack.h@....de" <knaack.h@....de>,
        "pmeerw@...erw.net" <pmeerw@...erw.net>,
        "linux-iio@...r.kernel.org" <linux-iio@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] iio: adc: ad7476: fix clang -Wpointer-bool-conversion
 warning

On Tue, 2020-05-05 at 16:23 +0200, Arnd Bergmann wrote:
> [External]
> 
> Checking the pointer value of st->chip_info->convst_channel is pointless
> since this this an array inside of a struct: even if st->chip_info is NULL,
> the pointer is non-zero. Clang warns about this:
> 
> drivers/iio/adc/ad7476.c:312:40: warning: address of array 'st->chip_info-
> >convst_channel' will always evaluate to 'true' [-Wpointer-bool-conversion]
>         if (st->convst_gpio && st->chip_info->convst_channel)
>                             ~~ ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
> 
> I could not come up with a sane way to check whether the entry
> is valid, so just remove the check and keep the behavior as it
> is today but without the warning.

There's already a patch for this, in one of Jonathan's branches.
https://patchwork.kernel.org/patch/11507829/

Thanks
Alex

> 
> Fixes: 3a6af93dd66e ("iio: adc: ad7476: Add IIO_CHAN_INFO_RAW for AD7091R")
> Signed-off-by: Arnd Bergmann <arnd@...db.de>
> ---
>  drivers/iio/adc/ad7476.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/adc/ad7476.c b/drivers/iio/adc/ad7476.c
> index e9984a38fc4c..4e816d714ad2 100644
> --- a/drivers/iio/adc/ad7476.c
> +++ b/drivers/iio/adc/ad7476.c
> @@ -309,7 +309,7 @@ static int ad7476_probe(struct spi_device *spi)
>  	indio_dev->num_channels = 2;
>  	indio_dev->info = &ad7476_info;
>  
> -	if (st->convst_gpio && st->chip_info->convst_channel)
> +	if (st->convst_gpio)
>  		indio_dev->channels = st->chip_info->convst_channel;
>  	/* Setup default message */
>  

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ