When KFENCE is compiled in but disabled at boot (KFENCE_SAMPLE_INTERVAL=0) or __kfence_pool is not allocated, every kfence kunit case fails with -EINVAL.
Use kunit_skip() so they are reported as skipped instead. To: Alexander Potapenko <[email protected]> To: Marco Elver <[email protected]> To: Dmitry Vyukov <[email protected]> To: Andrew Morton <[email protected]> Cc: [email protected] Cc: [email protected] Signed-off-by: Jia He <[email protected]> --- mm/kfence/kfence_test.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mm/kfence/kfence_test.c b/mm/kfence/kfence_test.c index 5725a367246d..e376329dd621 100644 --- a/mm/kfence/kfence_test.c +++ b/mm/kfence/kfence_test.c @@ -822,8 +822,10 @@ static int test_init(struct kunit *test) unsigned long flags; int i; - if (!__kfence_pool) - return -EINVAL; + if (!__kfence_pool) { + kunit_skip(test, "kfence pool not allocated or kfence not enabled"); + return 0; + } spin_lock_irqsave(&observed.lock, flags); for (i = 0; i < ARRAY_SIZE(observed.lines); i++) -- 2.34.1

