]> www.infradead.org Git - users/dwmw2/linux.git/commit
kunit: executor: Simplify string allocation handling
authorKees Cook <kees@kernel.org>
Thu, 11 Jul 2024 16:54:32 +0000 (09:54 -0700)
committerShuah Khan <skhan@linuxfoundation.org>
Fri, 12 Jul 2024 16:11:48 +0000 (10:11 -0600)
commit7554a7b96dc0dcc445d4af7077c96c6ab0988c79
treebcd0d2c6b0ed34392dfc15f22f6aea58e7b26ef7
parent67c9971cd6d309ecbcb87b942e22ffc194d7a376
kunit: executor: Simplify string allocation handling

The alloc/copy code pattern is better consolidated to single kstrdup (and
kstrndup) calls instead. This gets rid of deprecated[1] strncpy() uses as
well. Replace one other strncpy() use with the more idiomatic strscpy().

Link: https://github.com/KSPP/linux/issues/90
Reviewed-by: David Gow <davidgow@google.com>
Signed-off-by: Kees Cook <kees@kernel.org>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
lib/kunit/executor.c
lib/kunit/executor_test.c