[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3bc8fda47dc04e3b8cfd0e3f6fc7bbee@AcuMS.aculab.com>
Date: Wed, 27 Sep 2023 07:51:05 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Alexander Potapenko' <glider@...gle.com>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
CC: "catalin.marinas@....com" <catalin.marinas@....com>,
"will@...nel.org" <will@...nel.org>,
"pcc@...gle.com" <pcc@...gle.com>,
"andreyknvl@...il.com" <andreyknvl@...il.com>,
"linux@...musvillemoes.dk" <linux@...musvillemoes.dk>,
"yury.norov@...il.com" <yury.norov@...il.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>,
"eugenis@...gle.com" <eugenis@...gle.com>,
"syednwaris@...il.com" <syednwaris@...il.com>,
"william.gray@...aro.org" <william.gray@...aro.org>
Subject: RE: [PATCH v5 2/5] lib/test_bitmap: add tests for
bitmap_{read,write}()
...
> 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)
Powered by blists - more mailing lists