Skip to content

bitmap: keep unused tail bits out of bitmap_cut() results

Jinseob Kim lkml 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2bitmap: ignore unused tail bits in bitmap_cut()lib/bitmap.c lib/test_bitmap.c+3 -10 replies
2/2lib/test_bitmap: cover unused tail bits in bitmap_cut()lib/test_bitmap.c+90 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/2] bitmap: keep unused tail bits out of bitmap_cut() results

bitmap_cut() can shift an unused bit from the last storage word into the valid result. Patch 1 masks the copied tail before shifting and corrects the existing test expectation. Patch 2 adds checks for partial words and overlapping buffers.

With identical CONFIG_TEST_BITMAP sources and configuration on x86_64 UML with GCC 13.3.0, the original failed 21 of 391,596 checks and the fixed version passed all 391,596. Clang 18.1.3 compiled both modified objects. A 32-bit kernel and a Clang-built kernel were not booted.

Jinseob Kim (2):
bitmap: ignore unused tail bits in bitmap_cut() lib/test_bitmap: cover unused tail bits in bitmap_cut()

 lib/bitmap.c      |  2 +
 lib/test_bitmap.c | 93 ++++++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 93 insertions(+), 2 deletions(-)