* [PATCH] selftests/x86/ioperm: exit non-zero on child error
@ 2026-10-21 21:17 Greg Thelen
0 siblings, 0 replies; only message in thread
From: Greg Thelen @ 2026-10-21 21:17 UTC (permalink / raw)
To: Shuah Khan, Dave Hansen, Thomas Gleixner, Ingo Molnar,
Borislav Petkov, x86
Cc: linux-kselftest, linux-kernel, Greg Thelen
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 <gthelen@google.com>
---
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 69d5fb7050c2..6c36e316de95 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.56.0.218.g1ec904b173-goog
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-10-21 21:17 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-21 21:17 [PATCH] selftests/x86/ioperm: exit non-zero on child error Greg Thelen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®