]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
bitmap: exclude nbits == 0 cases from bitmap test
authorYury Norov <ynorov@nvidia.com>
Thu, 19 Mar 2026 00:43:47 +0000 (20:43 -0400)
committerYury Norov <ynorov@nvidia.com>
Mon, 23 Mar 2026 17:56:25 +0000 (13:56 -0400)
commit2a4d3706d864d19ba8772b7a5e74328ac5c1007d
treed6e97c1ad6de09b617c1163ac8e8cfddaaca2a4d
parente9cf8f83c9857a32494002c72b5f6e36ff4dfcd5
bitmap: exclude nbits == 0 cases from bitmap test

Bitmap API handles nbits == 0 in most cases correctly, i.e. it doesn't
dereferene underlying bitmap and returns a sane value where convenient,
or implementation defined, or undef.

Implicitly testing nbits == 0 case, however, may make an impression that
this is a regular case. This is wrong. In most cases nbits == 0 is a
sign of an error on a client side. The tests should not make such an
implression.

This patch reworks the existing tests to not test nbits == 0. The
following patch adds an explicit test for it with an appropriate
precaution.

Signed-off-by: Yury Norov <ynorov@nvidia.com>
lib/test_bitmap.c