[GIT PULL] KUnit fixes update for Linux 6.2-rc2

From: Shuah Khan
Date: Thu Dec 29 2022 - 18:07:43 EST


Hi Linus,

Please pull the following KUnit fixes update for Linux 6.2-rc2.

This KUnit update for Linux 6.2-rc2 consists of:

- alloc_string_stream_fragment() error path fix to free before
returning a failure.

diff is attached.

thanks,
-- Shuah

----------------------------------------------------------------
The following changes since commit 1b929c02afd37871d5afb9d498426f83432e71c2:

Linux 6.2-rc1 (2022-12-25 13:41:39 -0800)

are available in the Git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest tags/linux-kselftest-kunit-fixes-6.2-rc2

for you to fetch changes up to 93ef83050e597634d2c7dc838a28caf5137b9404:

kunit: alloc_string_stream_fragment error handling bug fix (2022-12-26 16:01:36 -0700)

----------------------------------------------------------------
linux-kselftest-kunit-fixes-6.2-rc2

This KUnit update for Linux 6.2-rc2 consists of:

- alloc_string_stream_fragment() error path fix to free before
returning a failure.

----------------------------------------------------------------
YoungJun.park (1):
kunit: alloc_string_stream_fragment error handling bug fix

lib/kunit/string-stream.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------diff --git a/lib/kunit/string-stream.c b/lib/kunit/string-stream.c
index f5f51166d8c2..cc32743c1171 100644
--- a/lib/kunit/string-stream.c
+++ b/lib/kunit/string-stream.c
@@ -23,8 +23,10 @@ static struct string_stream_fragment *alloc_string_stream_fragment(
return ERR_PTR(-ENOMEM);

frag->fragment = kunit_kmalloc(test, len, gfp);
- if (!frag->fragment)
+ if (!frag->fragment) {
+ kunit_kfree(test, frag);
return ERR_PTR(-ENOMEM);
+ }

return frag;
}