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: Richa
On 27/09/2023 17:50, Richard Fitzgerald wrote:
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
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: Richa
NULL pointers so that client cleanup code can call
string_stream_destroy() unconditionally - which could include
pointers that have never been set to anything and so are NULL.
Signed-off-by: Richard Fitzgerald
---
lib/kunit/string-stream.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Move the call to kunit_suite_has_succeeded() after the check that
the kunit_suite pointer is valid.
This was found by smatch:
lib/kunit/debugfs.c:66 debugfs_print_results() warn: variable
dereferenced before check 'suite' (see line 63)
Signed-off-by: Richard Fitzgerald
Report
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: Richa
NULL pointers so that client cleanup code can call
string_stream_destroy() unconditionally - which could include
pointers that have never been set to anything and so are NULL.
Signed-off-by: Richard Fitzgerald
---
lib/kunit/string-stream.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Move the call to kunit_suite_has_succeeded() after the check that
the kunit_suite pointer is valid.
This was found by smatch:
lib/kunit/debugfs.c:66 debugfs_print_results() warn: variable
dereferenced before check 'suite' (see line 63)
Signed-off-by: Richard Fitzgerald
Report
x27;) converts to incompatible
function type [-Wcast-function-type-strict]
564 full_log = string_stream_get_string(test->log);
> 565 kunit_add_action(test, (kunit_action_t *)kfree, full_log);
Signed-off-by: Richard Fitzgerald
Reported-by: kernel test robot
Closes:
h
On 6/11/23 17:23, Richard Fitzgerald wrote:
In kunit_log_test() pass the kfree_wrapper() function to kunit_add_action()
instead of directly passing kfree().
Aargh! Sorry, noticed spurious word in commit title. Will send a V2.
x27;) converts to incompatible
function type [-Wcast-function-type-strict]
564 full_log = string_stream_get_string(test->log);
> 565 kunit_add_action(test, (kunit_action_t *)kfree, full_log);
Signed-off-by: Richard Fitzgerald
Reported-by: kernel test robot
Closes:
h
lue and passing the
boolean result of this comparison to KUNIT_EXPECT_TRUE(), as was already
done a few lines above in string_stream_managed_init_test().
Signed-off-by: Richard Fitzgerald
Fixes: d1a0d699bfc0 ("kunit: string-stream: Add tests for freeing
resource-managed string_stream"
kunit: Fix wild-memory-access bug in
kunit_free_suite_set()")
Signed-off-by: Marco Pagani
Tested-by: Richard Fitzgerald
Fixed this crash:
https://lore.kernel.org/all/e239b94b-462a-41e5-9a4c-cd1ffd530...@opensource.cirrus.com/
Also tested with sound/pci/hda/cirrus_scodec_test.c
suite->log must be checked for NULL before passing it to
string_stream_clear(). This was done in kunit_init_test() but was missing
from kunit_init_suite().
Signed-off-by: Richard Fitzgerald
Fixes: 6d696c4695c5 ("kunit: add ability to run tests after boot using debugfs")
---
lib/kun
nd
in the second case the RHS is already a pointer to the same type.
Signed-off-by: Richard Fitzgerald
---
include/kunit/static_stub.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/kunit/static_stub.h b/include/kunit/static_stub.h
index 85315c80b303..bf94032
add_one directly.
Signed-off-by: Richard Fitzgerald
---
lib/kunit/kunit-example-test.c | 27 +++
1 file changed, 27 insertions(+)
diff --git a/lib/kunit/kunit-example-test.c b/lib/kunit/kunit-example-test.c
index d2f7a3c62c18..9e57f341dc37 100644
--- a/lib/kunit/kunit
ecked
v2:
- add include
Fixes: 2810c1e99867 ("kunit: Fix wild-memory-access bug in
kunit_free_suite_set()")
Tested-by: Richard Fitzgerald
Reviewed-by: Javier Martinez Canillas
Signed-off-by: Marco Pagani
---
For V3:
Tested-by: Richard Fitzgerald
Fixes this crash:
https://lore.kernel.
terminate the test
at that point. It's preferable that the KUNIT_EXPECT_STR*() macros can
handle NULL pointers as a failure.
Signed-off-by: Richard Fitzgerald
---
include/kunit/test.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/kunit/test.h b/include/kunit/test.h
add_one directly.
Signed-off-by: Richard Fitzgerald
---
V2: Added comment for add_one_fn_ptr.
---
lib/kunit/kunit-example-test.c | 35 ++
1 file changed, 35 insertions(+)
diff --git a/lib/kunit/kunit-example-test.c b/lib/kunit/kunit-example-test.c
index
nd
in the second case the RHS is already a pointer to the same type.
Signed-off-by: Richard Fitzgerald
Reviewed-by: Rae Moar
---
No changes since V1.
---
include/kunit/static_stub.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/kunit/static_stub.h b/include/kunit/
On 22/12/23 08:39, David Gow wrote:
On Wed, 20 Dec 2023 at 23:52, Richard Fitzgerald
wrote:
Add NULL checks to KUNIT_BINARY_STR_ASSERTION() so that it will fail
cleanly if either pointer is NULL, instead of causing a NULL pointer
dereference in the strcmp().
A test failure could be that a
issue and have found the following commit to be the first bad
commit.
`
commit a0b84213f947176ddcd0e96e0751a109f28cde21
Author: Richard Fitzgerald r...@opensource.cirrus.com
Date: Mon Dec 18 15
22 matches
Mail list logo