Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests/harness: Limit step counter reporting

When the selftest "step" counter grew beyond 255, non-fatal warnings
were being emitted, which is noisy and pointless. There are selftests
with more than 255 steps (especially those in loops, etc). Instead,
just cap "steps" to 254 and do not report the saturation.

Reported-by: Ralph Campbell <rcampbell@nvidia.com>
Tested-by: Ralph Campbell <rcampbell@nvidia.com>
Fixes: 9847d24af95c ("selftests/harness: Refactor XFAIL into SKIP")
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>

authored by

Kees Cook and committed by
Shuah Khan
850d0cc6 4c6614dc

+2 -7
+2 -7
tools/testing/selftests/kselftest_harness.h
··· 680 680 __bail(_assert, _metadata->no_print, _metadata->step)) 681 681 682 682 #define __INC_STEP(_metadata) \ 683 - if (_metadata->passed && _metadata->step < 255) \ 683 + /* Keep "step" below 255 (which is used for "SKIP" reporting). */ \ 684 + if (_metadata->passed && _metadata->step < 253) \ 684 685 _metadata->step++; 685 686 686 687 #define is_signed_type(var) (!!(((__typeof__(var))(-1)) < (__typeof__(var))1)) ··· 977 976 t->passed = 0; 978 977 } else if (t->pid == 0) { 979 978 t->fn(t, variant); 980 - /* Make sure step doesn't get lost in reporting */ 981 - if (t->step >= 255) { 982 - ksft_print_msg("Too many test steps (%u)!?\n", t->step); 983 - t->step = 254; 984 - } 985 - /* Use 255 for SKIP */ 986 979 if (t->skip) 987 980 _exit(255); 988 981 /* Pass is exit 0 */