lib/genalloc: fix a NULL pool check and add KUnit tests
Get series with b4
b4 am [email protected] change-id 20261106-kunit-genalloc-32ccb20f97a6Versions newest first
- v1 Latest2 patches 1 replyIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | lib/genalloc: don't dereference a NULL pool in gen_pool_dma_[z]alloc()lib/ | +6 | 1 reply | |
| 2/2 | lib/tests: add KUnit tests for genalloclib/ lib/ lib/ | +524 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH 0/2] lib/genalloc: fix a NULL pool check and add KUnit tests
genalloc has no unit tests, so patch 2 adds a KUnit suite. Writing it turned up that gen_pool_dma_alloc() and gen_pool_dma_zalloc() crash on a NULL pool, while the other DMA helpers return NULL as gen_pool_dma_alloc() originally did. Patch 1 restores the check; no in-tree caller passes a NULL pool, so it is not marked for stable.
Tested on UML with a kunitconfig of CONFIG_KUNIT=y and CONFIG_GENALLOC_KUNIT_TEST=y: 12/12 pass with patch 1, and genalloc_dma_test crashes without it.
---
Amit Patole (2):
lib/genalloc: don't dereference a NULL pool in gen_pool_dma_[z]alloc() lib/tests: add KUnit tests for genalloc
lib/Kconfig.debug | 15 ++ lib/genalloc.c | 6 + lib/tests/Makefile | 1 + lib/tests/genalloc_kunit.c | 508 +++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 530 insertions(+)
---
base-commit: 05441d697f7f9a927264f4058cbbc6a03dfcac9d
change-id: 20261106-kunit-genalloc-32ccb20f97a6
Best regards,
Signature · 1 line
Amit Patole <[email protected]>