selftests/x86/ioperm: exit non-zero on child error
PATCH 1/1 selftests/x86/ioperm: exit non-zero on child error
ioperm.c increments the file-scope nerrs counter when the forked child dies or exits with a non-zero status, but main() unconditionally returns 0 at the end without inspecting nerrs. In addition to masking child test failures, this triggers a Clang 23 warning:
ioperm.c:25:12: error: variable 'nerrs' set but not used [-Werror,-Wunused-but-set-global]
Return 'nerrs ? 1 : 0' from main(), matching other x86 selftests such as iopl.c and ldt_gdt.c.
Fixes 0eb1d0fa6a68 ("selftests/x86: Add a basic selftest for ioperm")
Signed-off-by Greg Thelen <[email protected]>
--- tools/testing/selftests/x86/ioperm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/x86/ioperm.c +2 -2
@@ -144,7 +144,7 @@ int main(void)printf ("\tDrop privileges\n" );if (setresuid (1 ,1 ,1 ) !=0 ) {printf ("[WARN]\tDropping privileges failed\n" ); -return 0 ; +return nerrs ?1 :0 ; }printf ("[RUN]\tdisable 0x80\n" );
@@ -160,5 +160,5 @@ int main(void)return 1 ; }printf ("[OK]\tit failed\n" ); -return 0 ; +return nerrs ?1 :0 ; }
Signature · 1 line
2.56.0.218.g1ec904b173-goog