Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp3800208pxv; Tue, 13 Jul 2021 04:10:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxHzuIHlmKru0NCTiCFjfexbUWNLz5PEEgZAGDRqmRkJnMxh07N3vu+hurZ6sZb3uZuiZuY X-Received: by 2002:a17:906:838f:: with SMTP id p15mr4995518ejx.300.1626174636040; Tue, 13 Jul 2021 04:10:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626174636; cv=none; d=google.com; s=arc-20160816; b=XZ5wVBhhirU7rvXZoRvwnsNW9jjvZ+1ZuQ5t9VTZBYT9LYA4lhsYcu2Yhd8ZKgwRP5 bh7+gc15pi7XsXYKfNRuQ+wzONW5YeI/9SJbJyPaIJ14wt18lapPDJ1ouTwqD/QzUTGi 0xIGueP2Xpnil7i9bZOpwey86FYo4wxRLaPATc54mmigZPboWUqR7nUm3aQQoQbOTWHl Z/yVSP8SG5cY8K5wJBPB0upyCCYue8NpLDyRfmMk8ckMWeKCkX7/FyzXpwGXsVHqn0dq Onk7tMuN7pbD6xbmsm9EUgk8RcIrJpwaMZW8ruvzelh5/Wgyb1rpwgPZqHg9W3Lrm6Tt Hccw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :mime-version:accept-language:in-reply-to:references:message-id:date :thread-index:thread-topic:subject:cc:to:from; bh=8asnorqcLN5Wtromha74MFZdi2IP1QiKpFK/qishy70=; b=R7denHBtQudEUPl1SrmUijnb4HrTxiOwpriLAuPNMAu/wWu6ZL/awp/VOXw0PNzlRw EMPhbPv9OsDreRg+ZWj4MAfUZ6YMzZ5As8ZjKBiuUV9bfZxzY6M4iw1OscAyFNHwAIjX rUAdgO2uzQKjK1azB9hLOXjMvVyO71IMSja5/EHHEvdkVhDyKhmjU588kgpuvuygbsSE a31IvspR2jEY1bFZdUR9/LMYdQma5lMwC9SP8VZ+1MiEWH93yOcPw2SExndj+Q1DhbXV +8tiiOWvCdR0CD+mqlMzb2ios/09EnSeirDFGv90+B696fM69FnnyoVDlk4aYCihFo4a wr4w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ai6si17317081ejc.700.2021.07.13.04.10.12; Tue, 13 Jul 2021 04:10:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235813AbhGMLJz convert rfc822-to-8bit (ORCPT + 99 others); Tue, 13 Jul 2021 07:09:55 -0400 Received: from eu-smtp-delivery-151.mimecast.com ([185.58.86.151]:47737 "EHLO eu-smtp-delivery-151.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231838AbhGMLJz (ORCPT ); Tue, 13 Jul 2021 07:09:55 -0400 Received: from AcuMS.aculab.com (156.67.243.121 [156.67.243.121]) (Using TLS) by relay.mimecast.com with ESMTP id uk-mta-149-IVa75z0JOaOBrGaXpniqdQ-1; Tue, 13 Jul 2021 12:07:03 +0100 X-MC-Unique: IVa75z0JOaOBrGaXpniqdQ-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.18; Tue, 13 Jul 2021 12:07:01 +0100 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.018; Tue, 13 Jul 2021 12:07:01 +0100 From: David Laight To: 'Russell King' , =?iso-8859-1?Q?Uwe_Kleine-K=F6nig?= CC: Salah Triki , "fabrice.gasnier@foss.st.com" , "thierry.reding@gmail.com" , "lee.jones@linaro.org" , "mcoquelin.stm32@gmail.com" , "alexandre.torgue@foss.st.com" , "linux-pwm@vger.kernel.org" , "linux-stm32@st-md-mailman.stormreply.com" , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH] divide by 3*sizeof(u32) when computing array_size Thread-Topic: [PATCH] divide by 3*sizeof(u32) when computing array_size Thread-Index: AQHXd8hGdzQpdmgYHUiEx+VC3p1WwKtAvfwg Date: Tue, 13 Jul 2021 11:07:00 +0000 Message-ID: <012ccfea2a564274bd9d2e1cfc130873@AcuMS.aculab.com> References: <20210712231910.GA1831270@pc> <20210713063053.qqttzxlopvpnadj3@pengutronix.de> <20210713091954.GG22278@shell.armlinux.org.uk> In-Reply-To: <20210713091954.GG22278@shell.armlinux.org.uk> 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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Russell King > Sent: 13 July 2021 10:20 .... > I would also note that the code relies on there being no padding in > struct stm32_breakinput - it should be noted that a strict > interpretation of the C standard allows padding to be added anywhere > to a structure - at the start, end or between members. I'm pretty certain I remember that padding before the first member isn't allowed. In any case the kernel generally assumes there is no extra padding. (eg for structures that map hardware registers.) For big structures it is worth adding a compile-time check of the structure size - but not really for three u32. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)