From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B68E1C433EF for ; Sat, 5 Feb 2022 13:40:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:In-Reply-To:References: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=J7dv+fYwS1WEnqDKA2bM8GFFi9AgWYtt0zVhfBE27Rc=; b=0JzQ14yLFL09Y/ s+FMahjF8OeJgKOGtphTb1olsgYNRPJLYUai9AxFWe7jXlppc8zFBeekmzdzyXysuJuiP20QppzAy okYemgGgmzLHHFelcKgh35EJTfUHZLq1O76l/attmwbGtojfgSdcof2FaiSZf0AFn46L50Uv59mz8 7MGOG9Biw0kw5O9ou4BeyYcI6Uc3ViTKl4wNzW5So4AbJ+HnJjryunMxEkLSnLU/pC9XKMw0z9l5s jNC29gvNWTBhpjVXmJ278+6GQ95pwjlDI6h4OywGjfbwDjxwizp6WoIMmjQZKcX672VO72M+k4gvF jRqvQYONj0AW9xPS7cLQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nGLH6-006Yvr-2P; Sat, 05 Feb 2022 13:38:48 +0000 Received: from eu-smtp-delivery-151.mimecast.com ([185.58.86.151]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nGLH1-006Yuv-UY for linux-arm-kernel@lists.infradead.org; Sat, 05 Feb 2022 13:38:45 +0000 Received: from AcuMS.aculab.com (156.67.243.121 [156.67.243.121]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id uk-mta-95-HcbmPPd0MRO8RZEsIYtPtQ-1; Sat, 05 Feb 2022 13:38:40 +0000 X-MC-Unique: HcbmPPd0MRO8RZEsIYtPtQ-1 Received: from AcuMS.Aculab.com (fd9f:af1c:a25b:0:994c:f5c2:35d6:9b65) by AcuMS.aculab.com (fd9f:af1c:a25b:0:994c:f5c2:35d6:9b65) with Microsoft SMTP Server (TLS) id 15.0.1497.28; Sat, 5 Feb 2022 13:38:39 +0000 Received: from AcuMS.Aculab.com ([fe80::994c:f5c2:35d6:9b65]) by AcuMS.aculab.com ([fe80::994c:f5c2:35d6:9b65%12]) with mapi id 15.00.1497.028; Sat, 5 Feb 2022 13:38:39 +0000 From: David Laight To: 'Yury Norov' , Kees Cook CC: Jonathan Cameron , Lars-Peter Clausen , Maxime Coquelin , Alexandre Torgue , "linux-kernel@vger.kernel.org" , "linux-iio@vger.kernel.org" , "linux-stm32@st-md-mailman.stormreply.com" , "linux-arm-kernel@lists.infradead.org" , "linux-hardening@vger.kernel.org" Subject: RE: [PATCH] iio: stmpe-adc: Use correctly sized arguments for bit field Thread-Topic: [PATCH] iio: stmpe-adc: Use correctly sized arguments for bit field Thread-Index: AQHYGX/W1vB0TJBlQkimao6oVwCSvqyE956A Date: Sat, 5 Feb 2022 13:38:39 +0000 Message-ID: References: <20211215232513.2070158-1-keescook@chromium.org> In-Reply-To: Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=C51A453 smtp.mailfrom=david.laight@aculab.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220205_053844_277769_EF1364F8 X-CRM114-Status: GOOD ( 17.81 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 > > --- > > 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) _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel