From: Karl Mehltretter <kmehltretter@gmail.com>
To: Brendan Higgins <brendan.higgins@linux.dev>,
David Gow <david@davidgow.net>, Rae Moar <raemoar63@gmail.com>
Cc: "Karl Mehltretter" <kmehltretter@gmail.com>,
"Thomas Weißschuh" <thomas.weissschuh@linutronix.de>,
"Shuah Khan" <skhan@linuxfoundation.org>,
linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com,
linux-kernel@vger.kernel.org
Subject: [PATCH next] kunit: Initialize filter error before disabled cleanup
Date: Mon, 14 Sep 2026 04:59:33 +0200 [thread overview]
Message-ID: <20260914025933.9832-1-kmehltretter@gmail.com> (raw)
In-Reply-To: <20260901-kunit-void-v1-1-c91952391d66@linutronix.de>
kunit_run_all_tests() jumps to free_out when KUnit execution is disabled.
If a boot filter is configured, free_out tests err even though
kunit_filter_suites() was never called to initialize it.
Clang's -Wconditional-uninitialized diagnoses this path. KMSAN confirms
the runtime use.
With CONFIG_KUNIT_DEFAULT_ENABLED=n,
CONFIG_KUNIT_DEFAULT_FILTER_GLOB="*", CONFIG_INIT_STACK_NONE=y and
CONFIG_KMSAN=y, KMSAN reports an uninitialized-value use in
kunit_run_all_tests() and identifies local variable err as its origin.
Restore the zero initializer. It remains necessary as cleanup state after
kunit_run_all_tests() was changed to return void.
Fixes: e38f53f04824 ("kunit: Return void from kunit_run_all_tests()")
Signed-off-by: Karl Mehltretter <kmehltretter@gmail.com>
---
lib/kunit/executor.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/kunit/executor.c b/lib/kunit/executor.c
index c798a02470d8..6e4664ad82ad 100644
--- a/lib/kunit/executor.c
+++ b/lib/kunit/executor.c
@@ -382,7 +382,7 @@ void kunit_run_all_tests(void)
__kunit_suites_start, __kunit_suites_end,
};
size_t init_num_suites = init_suite_set.end - init_suite_set.start;
- int err;
+ int err = 0;
if (init_num_suites > 0) {
suite_set = kunit_merge_suite_sets(init_suite_set, normal_suite_set);
base-commit: 68142f986ff04b2b70b31db00f719bf690f64a9a
--
2.53.0
next prev parent reply other threads:[~2026-09-14 3:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-01 9:50 [PATCH] kunit: Return void from kunit_run_all_tests() Thomas Weißschuh
2026-09-02 13:29 ` David Gow
2026-09-14 2:59 ` Karl Mehltretter [this message]
2026-09-25 7:43 ` [PATCH next] kunit: Initialize filter error before disabled cleanup Thomas Weißschuh
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=20260914025933.9832-1-kmehltretter@gmail.com \
--to=kmehltretter@gmail.com \
--cc=brendan.higgins@linux.dev \
--cc=david@davidgow.net \
--cc=kunit-dev@googlegroups.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=raemoar63@gmail.com \
--cc=skhan@linuxfoundation.org \
--cc=thomas.weissschuh@linutronix.de \
/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®