lib/assoc_array: fix root-shortcut split lookup regression, add KUnit tests
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest2 patches 0 repliesNew
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | lib/assoc_array: add KUnit test suitelib/ lib/ lib/ | +981 | 0 replies | |
| 2/2 | lib/assoc_array: fix lookups after splitting a root shortcutlib/ lib/ | +30 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH 0/2] lib/assoc_array: fix root-shortcut split lookup regression, add KUnit tests
This series adds a KUnit test suite for lib/assoc_array.c and fixes a lookup bug that suite exposes.
When a root shortcut is split at the first level-segment boundary, the replacement node is installed one segment too shallow. Lookups then walk the tree at the wrong depth, so a fraction of previously inserted keys can no longer be found, even though they remain in the array.
Patch 1 adds the test suite; it passes on mainline. Patch 2 fixes the split path in assoc_array_insert() and adds a regression test that fails without the fix, keeping the series bisection-clean.
The fix was checked by exhaustive fan-out enumeration, randomized stress runs, and KASAN; the patch 2 commit message describes the mechanism in detail.
William Chuang (2):
lib/assoc_array: add KUnit test suite lib/assoc_array: fix lookups after splitting a root shortcut
lib/Kconfig.debug | 17 + lib/assoc_array.c | 3 +- lib/tests/Makefile | 1 + lib/tests/assoc_array_kunit.c | 991 ++++++++++++++++++++++++++++++++++ 4 files changed, 1011 insertions(+), 1 deletion(-) create mode 100644 lib/tests/assoc_array_kunit.c
Signature · 1 line
2.39.1