From: sashiko-bot@kernel.org
To: "Theodore Ts'o" <tytso@mit.edu>,
"Ext4 Developers List" <linux-ext4@vger.kernel.org>
Subject: Re: [PATCH -v2 10/26] ext4: add KUnit tests for fs/ext4/balloc.c
Date: Thu, 19 Nov 2026 16:06:39 +0000 [thread overview]
Message-ID: <sashiko-outbox-223468@kernel.org> (raw)
In-Reply-To: <20261119155658.1940864-11-tytso@mit.edu>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] ext4: kunit: leak of ctx in balloc_test_init() if
kunit_kzalloc() fails
--
commit 12a7df5573859469528c2402fafb82063d22f755
Author: Theodore Ts'o <tytso@mit.edu>
ext4: add KUnit tests for fs/ext4/balloc.c
This commit adds a KUnit test suite in fs/ext4/balloc-test.c to exercise
block bitmap management, group descriptor and overhead calculations,
cluster pool reservation, and metadata block allocation helpers in
fs/ext4/balloc.c.
> diff --git a/fs/ext4/balloc-test.c b/fs/ext4/balloc-test.c
> new file mode 100644
> index 0000000000000..b15d50907324f
> --- /dev/null
> +++ b/fs/ext4/balloc-test.c
> @@ -0,0 +1,2400 @@
[ ... ]
> +static int balloc_test_init(struct kunit *test)
> +{
> + struct balloc_test_ctx *ctx;
> + struct fs_context *fc;
> + struct super_block *sb;
> + struct ext4_sb_info *sbi;
> + struct inode *root_inode;
> + ext4_group_t g;
> + s64 total_free_clusters = 0;
> + s64 total_free_inodes = 0;
> + int err;
> +
> + ctx = kzalloc_obj(*ctx);
> + KUNIT_ASSERT_NOT_NULL(test, ctx);
> + test->priv = ctx;
> +
> + for (g = 0; g < BALLOC_TEST_MAX_GROUPS; g++) {
> + ctx->grp_infos[g] = kunit_kzalloc(test,
> + sizeof(*ctx->grp_infos[g]),
> + GFP_KERNEL);
> + KUNIT_ASSERT_NOT_NULL(test, ctx->grp_infos[g]);
> + }
> +
> + INIT_WORK(&ctx->sbi.s_discard_work, balloc_test_discard_work_fn);
> + rwlock_init(&ctx->journal.j_state_lock);\n+\n+\terr = kunit_add_action_or_reset(test, balloc_test_cleanup_action, ctx);
[Severity: Low]
Does this leak ctx if kunit_kzalloc() fails? KUNIT_ASSERT_NOT_NULL()
aborts the test before kunit_add_action_or_reset() registers
balloc_test_cleanup_action to free ctx.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261119155658.1940864-1-tytso@mit.edu?part=10
next prev parent reply other threads:[~2026-11-19 16:06 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-19 15:56 [PATCH -v2 00/26] ext4: add lots of KUnit tests! Theodore Ts'o
2026-11-19 15:56 ` [PATCH -v2 01/26] ext4: add KUinit tests for fs/ext4/extents_status.c Theodore Ts'o
2026-11-19 16:05 ` sashiko-bot
2026-11-19 15:56 ` [PATCH -v2 02/26] ext4: add KUnit tests for fs/ext4/extents.c Theodore Ts'o
2026-11-19 15:56 ` [PATCH -v2 03/26] ext4: add KUnit tests for fs/ext4/xattr.c Theodore Ts'o
2026-11-19 16:11 ` sashiko-bot
2026-11-19 15:56 ` [PATCH -v2 04/26] ext4: add KUnit tests for fs/ext4/namei.c Theodore Ts'o
2026-11-19 16:11 ` sashiko-bot
2026-11-19 15:56 ` [PATCH -v2 05/26] ext4: expand KUnit tests for fs/ext4/mballoc.c Theodore Ts'o
2026-11-19 16:08 ` sashiko-bot
2026-11-19 15:56 ` [PATCH -v2 06/26] ext4: add KUnit tests for fs/ext4/inline.c Theodore Ts'o
2026-11-19 16:07 ` sashiko-bot
2026-11-19 15:56 ` [PATCH -v2 07/26] ext4: add KUnit tests for fs/ext4/fast_commit.c Theodore Ts'o
2026-11-19 16:07 ` sashiko-bot
2026-11-19 15:56 ` [PATCH -v2 08/26] ext4: expand KUnit tests for fs/ext4/inode.c Theodore Ts'o
2026-11-19 16:07 ` sashiko-bot
2026-11-19 15:56 ` [PATCH -v2 09/26] ext4: add KUnit tests for fs/ext4/ialloc.c Theodore Ts'o
2026-11-19 16:13 ` sashiko-bot
2026-11-19 15:56 ` [PATCH -v2 10/26] ext4: add KUnit tests for fs/ext4/balloc.c Theodore Ts'o
2026-11-19 16:06 ` sashiko-bot [this message]
2026-11-19 15:56 ` [PATCH -v2 11/26] ext4: add KUnit tests for fs/ext4/orphan.c Theodore Ts'o
2026-11-19 16:07 ` sashiko-bot
2026-11-19 15:56 ` [PATCH -v2 12/26] ext4: add KUnit tests for fs/ext4/block_validity.c Theodore Ts'o
2026-11-19 16:12 ` sashiko-bot
2026-11-19 15:56 ` [PATCH -v2 13/26] ext4: check multi-block overlap on left traversal in add_system_zone() Theodore Ts'o
2026-11-19 16:00 ` sashiko-bot
2026-11-19 15:56 ` [PATCH -v2 14/26] ext4: enable full feature coverage in fs/ext4/.kunitconfig Theodore Ts'o
2026-11-19 16:12 ` sashiko-bot
2026-11-19 15:56 ` [PATCH -v2 15/26] ext4: add KUnit tests for fs/ext4/super.c Theodore Ts'o
2026-11-19 16:07 ` sashiko-bot
2026-11-19 15:56 ` [PATCH -v2 16/26] ext4: add KUnit tests for fs/ext4/sysfs.c Theodore Ts'o
2026-11-19 16:08 ` sashiko-bot
2026-11-19 15:56 ` [PATCH -v2 17/26] ext4: add KUnit tests for fs/ext4/ioctl.c Theodore Ts'o
2026-11-19 16:12 ` sashiko-bot
2026-11-19 15:56 ` [PATCH -v2 18/26] ext4: add KUnit tests for fs/ext4/resize.c Theodore Ts'o
2026-11-19 16:16 ` sashiko-bot
2026-11-19 15:56 ` [PATCH -v2 19/26] ext4: add KUnit tests for fs/ext4/migrate.c Theodore Ts'o
2026-11-19 16:11 ` sashiko-bot
2026-11-19 15:56 ` [PATCH -v2 20/26] ext4: add KUnit tests for fs/ext4/indirect.c Theodore Ts'o
2026-11-19 16:16 ` sashiko-bot
2026-11-19 15:56 ` [PATCH -v2 21/26] ext4: expand KUnit tests in fs/ext4/extents-test.c for file range operations Theodore Ts'o
2026-11-19 16:12 ` sashiko-bot
2026-11-19 15:56 ` [PATCH -v2 22/26] ext4: add KUnit tests for fs/ext4/fsmap.c Theodore Ts'o
2026-11-19 16:13 ` sashiko-bot
2026-11-19 15:56 ` [PATCH -v2 23/26] ext4: add KUnit tests for fs/ext4/move_extent.c Theodore Ts'o
2026-11-19 16:14 ` sashiko-bot
2026-11-19 15:56 ` [PATCH -v2 24/26] ext4: add KUnit tests for fs/ext4/mmp.c Theodore Ts'o
2026-11-19 16:12 ` sashiko-bot
2026-11-19 15:56 ` [PATCH -v2 25/26] ext4: add KUnit tests for fs/ext4/dir.c Theodore Ts'o
2026-11-19 15:56 ` [PATCH -v2 26/26] ext4: add KUnit regression tests for inode migration fixes Theodore Ts'o
2026-11-19 16:15 ` sashiko-bot
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=sashiko-outbox-223468@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-ext4@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=tytso@mit.edu \
/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