The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH 0/2] bitmap: keep unused tail bits out of bitmap_cut() results
@ 2026-11-23  4:31 Jinseob Kim
  2026-11-23  4:31 ` [PATCH 1/2] bitmap: ignore unused tail bits in bitmap_cut() Jinseob Kim
  2026-11-23  4:31 ` [PATCH 2/2] lib/test_bitmap: cover " Jinseob Kim
  0 siblings, 2 replies; 3+ messages in thread
From: Jinseob Kim @ 2026-11-23  4:31 UTC (permalink / raw)
  To: yury.norov; +Cc: linux, akpm, linux-kernel

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(-)


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-23  4:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-23  4:31 [PATCH 0/2] bitmap: keep unused tail bits out of bitmap_cut() results Jinseob Kim
2026-11-23  4:31 ` [PATCH 1/2] bitmap: ignore unused tail bits in bitmap_cut() Jinseob Kim
2026-11-23  4:31 ` [PATCH 2/2] lib/test_bitmap: cover " Jinseob Kim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox