Skip to content
Commit 1557e89d authored by Richard Fitzgerald's avatar Richard Fitzgerald Committed by Shuah Khan
Browse files

kunit: debugfs: Handle errors from alloc_string_stream()



In kunit_debugfs_create_suite() give up and skip creating the debugfs
file if any of the alloc_string_stream() calls return an error or NULL.
Only put a value in the log pointer of kunit_suite and kunit_test if it
is a valid pointer to a log.

This prevents the potential invalid dereference reported by smatch:

 lib/kunit/debugfs.c:115 kunit_debugfs_create_suite() error: 'suite->log'
	dereferencing possible ERR_PTR()
 lib/kunit/debugfs.c:119 kunit_debugfs_create_suite() error: 'test_case->log'
	dereferencing possible ERR_PTR()

Signed-off-by: default avatarRichard Fitzgerald <rf@opensource.cirrus.com>
Reported-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
Fixes: 05e2006c ("kunit: Use string_stream for test log")
Reviewed-by: default avatarRae Moar <rmoar@google.com>
Reviewed-by: default avatarDavid Gow <davidgow@google.com>
Signed-off-by: default avatarShuah Khan <skhan@linuxfoundation.org>
parent 34dfd5bb
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment