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 0F99EE810A0 for ; Wed, 27 Sep 2023 07:53:29 +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=UuffRdzqPXF9a0bFwd0GNds0mEICUO9DDfzZExb4hBI=; b=QUzl+FRwrbuOWY +0kkN2mlhkfWXZJdLocBt1A7SPCkgkmq0VtznY8rPkdE1hLz0k5FMebQSZc5sxL4M2JCBHizyh/ok 50K8aaCY+acYg+i1JInrwUdoa7uIDp8+So8Bq5nzVMOzE5SwgYChBgjv9hjLlRuTbRN4C2baGiuqt ykfcU2yTR/BgQQ2mT4M2x6jPfw8WmcB9KIlKXe4b6qYqG5Gh3CgHZwq26hkVwnk2MYrSs4ICrtdRA HnPYqns0aj3LeEzUN6T9E/SNbdmejdxOnud3tj7CFtGMfzhQ/2rzHNWZqtNlgaGrnWS+JBODUmhC5 +rvAz8bFCjStXG6AgGJg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qlPLx-000Gm0-35; Wed, 27 Sep 2023 07:53:01 +0000 Received: from eu-smtp-delivery-151.mimecast.com ([185.58.85.151]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qlPKE-000GZS-07 for linux-arm-kernel@lists.infradead.org; Wed, 27 Sep 2023 07:51:16 +0000 Received: from AcuMS.aculab.com (156.67.243.121 [156.67.243.121]) by relay.mimecast.com with ESMTP with both STARTTLS and AUTH (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id uk-mta-2-N8jkFFD4PBCGXqs1E3rfLg-1; Wed, 27 Sep 2023 08:51:06 +0100 X-MC-Unique: N8jkFFD4PBCGXqs1E3rfLg-1 Received: from AcuMS.Aculab.com (10.202.163.6) by AcuMS.aculab.com (10.202.163.6) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Wed, 27 Sep 2023 08:51:05 +0100 Received: from AcuMS.Aculab.com ([::1]) by AcuMS.aculab.com ([::1]) with mapi id 15.00.1497.048; Wed, 27 Sep 2023 08:51:05 +0100 From: David Laight To: 'Alexander Potapenko' , Andy Shevchenko CC: "catalin.marinas@arm.com" , "will@kernel.org" , "pcc@google.com" , "andreyknvl@gmail.com" , "linux@rasmusvillemoes.dk" , "yury.norov@gmail.com" , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "eugenis@google.com" , "syednwaris@gmail.com" , "william.gray@linaro.org" Subject: RE: [PATCH v5 2/5] lib/test_bitmap: add tests for bitmap_{read,write}() Thread-Topic: [PATCH v5 2/5] lib/test_bitmap: add tests for bitmap_{read,write}() Thread-Index: AQHZ78BAIg64eZGtOEOamqyNsX1LerAuTYZg Date: Wed, 27 Sep 2023 07:51:05 +0000 Message-ID: <3bc8fda47dc04e3b8cfd0e3f6fc7bbee@AcuMS.aculab.com> References: <20230922080848.1261487-1-glider@google.com> <20230922080848.1261487-3-glider@google.com> 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 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-20230927_005114_346749_65B1111F X-CRM114-Status: GOOD ( 10.97 ) 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 ... > Overall, unless allocating and initializing bitmaps with size > divisible by sizeof(long), most of bitmap.c is undefined behavior, so > I don't think it makes much sense to specifically test this case here > (given that we do not extend bitmap_equal() in the patch set). Bitmaps are arrays of unsigned long. Using any of the APIs on anything else is a bug. So it is always wrong to try to initialise 'a number of bytes'. The size used in the definition need not be a multiple of 8 (on 64bit) but the allocated data is always a multiple of 8. Any calls to the functions that have a cast of the bitmap parameter are likely to be buggy. And yes, there are loads of them, and many are buggy. On LE you mostly get away with shorter memory allocations. But still get errors when trying to do locked operations on misaligned addresses. 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