From: Amit Patole <amit.patole@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>,
Fredrik Noring <noring@nocrew.org>
Cc: Christoph Hellwig <hch@lst.de>,
Brendan Higgins <brendan.higgins@linux.dev>,
David Gow <david@davidgow.net>, Rae Moar <raemoar63@gmail.com>,
linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com,
linux-kernel@vger.kernel.org,
Amit Patole <amit.patole@gmail.com>
Subject: [PATCH 0/2] lib/genalloc: fix a NULL pool check and add KUnit tests
Date: Fri, 06 Nov 2026 09:02:31 -0500 [thread overview]
Message-ID: <20261106-kunit-genalloc-v1-0-ba1ea397dfd8@gmail.com> (raw)
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>
next reply other threads:[~2026-11-06 14:02 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-06 14:02 Amit Patole [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261106-kunit-genalloc-v1-0-ba1ea397dfd8@gmail.com \
--to=amit.patole@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=brendan.higgins@linux.dev \
--cc=david@davidgow.net \
--cc=hch@lst.de \
--cc=kunit-dev@googlegroups.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=noring@nocrew.org \
--cc=raemoar63@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®