On Wed, Oct 11, 2023 at 8:03 PM Andy Shevchenko
[off-list ref] wrote:
On Wed, Oct 11, 2023 at 07:28:32PM +0200, Alexander Potapenko wrote:
quoted
Add basic tests ensuring that values can be added at arbitrary positions
of the bitmap, including those spanning into the adjacent unsigned
longs.
Would be nice to have an additional test like
bitmap_write(..., 33 /* or anything > 32 */);
This will require ifdeffery. So at least this code may warn users about corner
cases in the agnostic code.
We could go with bitmap_write(..., BITS_PER_LONG + 1):
/*
* Setting/getting more than BITS_PER_LONG bits should not crash the
* kernel. READ_ONCE() prevents constant folding.
*/
bitmap_write(NULL, 0, 0, READ_ONCE(bits_per_long) + 1);
/* Return value of bitmap_read() is undefined here. */
bitmap_read(NULL, 0, READ_ONCE(bits_per_long) + 1);
I'll add the above code in v8 (sometime next week, hope to receive
some comments from the ARM folks).
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel