Re: [PATCH v2 0/6] bitmap: fix three parsing bugs in bitmap_parse() and bitmap_parselist()

From: Yury Norov

Date: Sat Sep 26 2026 - 10:19:49 EST


On Sat, Sep 26, 2026 at 06:56:45AM +0530, Shashank Mohan Jain wrote:
> This series fixes three cases where the bitmap string parsers accept
> input they are documented to reject, or produce a different mask than
> the one requested. Each fix is followed by a patch adding the failing
> cases to lib/test_bitmap.c.
>
> 1-2: bitmap_parse() treats a non-hex character directly before a chunk
> of exactly eight hex digits as a separator, so "x12345678" and
> "0x0000000f" are accepted while "0xf" is rejected. This is a
> regression from the bitmap_parse() rework; the old __bitmap_parse()
> rejected all of them.
>
> 3-4: bitmap_parselist() does not check for the end of the region after
> the group size of a "range:used/group" region, so since N and
> all became valid region starts, "0-7:1/2N" or "0-7:1/2all" are
> silently parsed as two regions.
>
> 5-6: bitmap_parselist() walks a "range:used/group" region with an
> unsigned int that wraps around when the group size is close to
> UINT_MAX, setting bits below the requested range. This needs an
> absurd group size and never writes out of bounds.
>
> With the series applied, test_bitmap reports "all 391544 tests passed"
> (UML, x86_64). The three fixes are independent and can be applied in
> any order.

Thanks, taking in bitmap-for-next for testing.

> These patches were prepared with Claude Code (Anthropic), model Claude Opus 5.5
> (claude-opus-5-5): the analysis, the Lean models used to find and check the bugs,
> the fixes and the tests. I reviewed them and take responsibility for them. The
> trailer only says "Assisted-by: LLM", as Documentation/process/coding-assistants.rst
> requires since commit 816d9992d9ed ("coding-assistants: simplify attribution").

Thanks, that helps. I use codex on daily basis. I asked it to review
your series, and it found no issues. I'll try Clause one day, for
sure.

If you send a material to me, and want share more details in the
Assisted-by line, feel free to do that.

Thanks,
Yury