diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2024-11-22 16:11:56 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2024-11-22 16:11:56 -0800 |
commit | e288c352a4a5716babf2edad4cba10ec6002a20a (patch) | |
tree | 37a202e1b1452e06ff0544edcbb31b218ef3da70 /lib | |
parent | 06afb0f36106ecb839c5e2509905e68c1e2677de (diff) | |
parent | 62adcae479fe5bc04fa3b6c3f93bd340441f8b25 (diff) |
Merge tag 'linux_kselftest-kunit-6.13-rc1-fixed' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest
Pull kunit updates from Shuah Khan:
- fix user-after-free (UAF) bug in kunit_init_suite()
- add option to kunit tool to print just the summary of test results
- add option to kunit tool to print just the failed test results
- fix kunit_zalloc_skb() to use user passed in gfp value instead of
hardcoding GFP_KERNEL
- fixe kunit_zalloc_skb() kernel doc to include allocation flags
variable
- update KUnit email address for Brendan Higgins
- add LoongArch config to qemu_configs
- allow overriding the shutdown mode from qemu config
- enable shutdown in loongarch qemu_config
- fix potential null dereference in kunit_device_driver_test()
- fix debugfs to use IS_ERR() for alloc_string_stream() error check
* tag 'linux_kselftest-kunit-6.13-rc1-fixed' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest:
kunit: qemu_configs: loongarch: Enable shutdown
kunit: tool: Allow overriding the shutdown mode from qemu config
kunit: qemu_configs: Add LoongArch config
kunit: debugfs: Use IS_ERR() for alloc_string_stream() error check
kunit: Fix potential null dereference in kunit_device_driver_test()
MAINTAINERS: Update KUnit email address for Brendan Higgins
kunit: string-stream: Fix a UAF bug in kunit_init_suite()
kunit: tool: print failed tests only
kunit: tool: Only print the summary
kunit: skb: add gfp to kernel doc for kunit_zalloc_skb()
kunit: skb: use "gfp" variable instead of hardcoding GFP_KERNEL
Diffstat (limited to 'lib')
-rw-r--r-- | lib/kunit/debugfs.c | 9 | ||||
-rw-r--r-- | lib/kunit/kunit-test.c | 2 |
2 files changed, 8 insertions, 3 deletions
diff --git a/lib/kunit/debugfs.c b/lib/kunit/debugfs.c index d548750a325a..af71911f4a07 100644 --- a/lib/kunit/debugfs.c +++ b/lib/kunit/debugfs.c @@ -181,7 +181,7 @@ void kunit_debugfs_create_suite(struct kunit_suite *suite) * successfully. */ stream = alloc_string_stream(GFP_KERNEL); - if (IS_ERR_OR_NULL(stream)) + if (IS_ERR(stream)) return; string_stream_set_append_newlines(stream, true); @@ -189,7 +189,7 @@ void kunit_debugfs_create_suite(struct kunit_suite *suite) kunit_suite_for_each_test_case(suite, test_case) { stream = alloc_string_stream(GFP_KERNEL); - if (IS_ERR_OR_NULL(stream)) + if (IS_ERR(stream)) goto err; string_stream_set_append_newlines(stream, true); @@ -212,8 +212,11 @@ void kunit_debugfs_create_suite(struct kunit_suite *suite) err: string_stream_destroy(suite->log); - kunit_suite_for_each_test_case(suite, test_case) + suite->log = NULL; + kunit_suite_for_each_test_case(suite, test_case) { string_stream_destroy(test_case->log); + test_case->log = NULL; + } } void kunit_debugfs_destroy_suite(struct kunit_suite *suite) diff --git a/lib/kunit/kunit-test.c b/lib/kunit/kunit-test.c index 37e02be1e710..d9c781c859fd 100644 --- a/lib/kunit/kunit-test.c +++ b/lib/kunit/kunit-test.c @@ -805,6 +805,8 @@ static void kunit_device_driver_test(struct kunit *test) struct device *test_device; struct driver_test_state *test_state = kunit_kzalloc(test, sizeof(*test_state), GFP_KERNEL); + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, test_state); + test->priv = test_state; test_driver = kunit_driver_create(test, "my_driver"); |