[PATCH] selftests/x86/ioperm: Fail the test when the child fails

From: Sasha Levin

Date: Tue Dec 01 2026 - 13:09:14 EST


main() counts a child that died or exited with an error in nerrs, but
nothing reads nerrs, so a failed child does not fail the test. clang 23
points that out:

ioperm.c:25:12: warning: variable 'nerrs' set but not used [-Wunused-but-set-global]

Return 1 when nerrs is set, like the other x86 selftests do.

Fixes: 0eb1d0fa6a68 ("selftests/x86: Add a basic selftest for ioperm")
Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>
---
tools/testing/selftests/x86/ioperm.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/x86/ioperm.c b/tools/testing/selftests/x86/ioperm.c
index 69d5fb7050c25..6c36e316de956 100644
--- a/tools/testing/selftests/x86/ioperm.c
+++ b/tools/testing/selftests/x86/ioperm.c
@@ -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;
}
--
2.53.0