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]
Date:   Sat, 5 Feb 2022 13:38:39 +0000
From:   David Laight <David.Laight@...LAB.COM>
To:     'Yury Norov' <yury.norov@...il.com>,
        Kees Cook <keescook@...omium.org>
CC:     Jonathan Cameron <jic23@...nel.org>,
        Lars-Peter Clausen <lars@...afoo.de>,
        Maxime Coquelin <mcoquelin.stm32@...il.com>,
        Alexandre Torgue <alexandre.torgue@...s.st.com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "linux-iio@...r.kernel.org" <linux-iio@...r.kernel.org>,
        "linux-stm32@...md-mailman.stormreply.com" 
        <linux-stm32@...md-mailman.stormreply.com>,
        "linux-arm-kernel@...ts.infradead.org" 
        <linux-arm-kernel@...ts.infradead.org>,
        "linux-hardening@...r.kernel.org" <linux-hardening@...r.kernel.org>
Subject: RE: [PATCH] iio: stmpe-adc: Use correctly sized arguments for bit
 field

From: Yury Norov
> Sent: 04 February 2022 04:30
> 
> On Wed, Dec 15, 2021 at 03:25:13PM -0800, Kees Cook wrote:
> > The find.h APIs are designed to be used only on unsigned long arguments.
> > This can technically result in a over-read, but it is harmless in this
> > case. Regardless, fix it to avoid the warning seen under -Warray-bounds,
> > which we'd like to enable globally:
> >
...
> >
> > Signed-off-by: Kees Cook <keescook@...omium.org>
> > ---
> >  drivers/iio/adc/stmpe-adc.c | 5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/iio/adc/stmpe-adc.c b/drivers/iio/adc/stmpe-adc.c
> > index fba659bfdb40..d2d405388499 100644
> > --- a/drivers/iio/adc/stmpe-adc.c
> > +++ b/drivers/iio/adc/stmpe-adc.c
> > @@ -256,6 +256,7 @@ static int stmpe_adc_probe(struct platform_device *pdev)
> >  	struct stmpe_adc *info;
> >  	struct device_node *np;
> >  	u32 norequest_mask = 0;
> > +	unsigned long bits;
> >  	int irq_temp, irq_adc;
> >  	int num_chan = 0;
> >  	int i = 0;
> > @@ -309,8 +310,8 @@ static int stmpe_adc_probe(struct platform_device *pdev)
> >
> >  	of_property_read_u32(np, "st,norequest-mask", &norequest_mask);
> >
> > -	for_each_clear_bit(i, (unsigned long *) &norequest_mask,
> > -			   (STMPE_ADC_LAST_NR + 1)) {
> > +	bits = norequest_mask;
> 
> This would not work on 64-bit BE architecture. It should use bitmap_from_arr32()

The old version was wrong on 64 bit BE, Kees version is probably ok.

But changing norequest_mask to 'unsigned long' is probably neater.
OTOH using the bitmap functions on single words is just bloat.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ