mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/2] lib/genalloc: fix a NULL pool check and add KUnit tests
@ 2026-11-06 14:02 Amit Patole
  2026-11-06 14:02 ` [PATCH 1/2] lib/genalloc: don't dereference a NULL pool in gen_pool_dma_[z]alloc() Amit Patole
  2026-11-06 14:02 ` [PATCH 2/2] lib/tests: add KUnit tests for genalloc Amit Patole
  0 siblings, 2 replies; 4+ messages in thread
From: Amit Patole @ 2026-11-06 14:02 UTC (permalink / raw)
  To: Andrew Morton, Fredrik Noring
  Cc: Christoph Hellwig, Brendan Higgins, David Gow, Rae Moar,
	linux-kselftest, kunit-dev, linux-kernel, Amit Patole

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,
--  
Amit Patole <amit.patole@gmail.com>


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

end of thread, other threads:[~2026-11-06 18:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-06 14:02 [PATCH 0/2] lib/genalloc: fix a NULL pool check and add KUnit tests Amit Patole
2026-11-06 14:02 ` [PATCH 1/2] lib/genalloc: don't dereference a NULL pool in gen_pool_dma_[z]alloc() Amit Patole
2026-11-06 18:46   ` Fredrik Noring
2026-11-06 14:02 ` [PATCH 2/2] lib/tests: add KUnit tests for genalloc Amit Patole

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

all inboxes | Powered by JetHome®