[PATCH v4 1/3] checkpatch: Add more userspace directories to is_userspace()
From: Petr Vorel
Date: Mon Aug 10 2026 - 13:27:49 EST
arch/ directory contains subdirectories with userspace tools (at least
arch/*/tools/ and arch/*/boot/tools/). Add check to consider any
arch/.*/tools/ subdirectory as userspace tools directory.
This helps not only to strscpy() checks but also to CamelCase checks in
the next commit to be more precise.
Follow-up: 99b70ece33d8 ("checkpatch: suppress strscpy warnings for userspace tools")
Signed-off-by: Petr Vorel <pvorel@xxxxxxx>
---
Changes v3->v4:
* Change test for directory to be more more generic (Joe)
scripts/checkpatch.pl | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 4f7325fd5825..1c6ef46bae1e 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2665,7 +2665,9 @@ sub exclude_global_initialisers {
sub is_userspace {
my ($realfile) = @_;
- return ($realfile =~ m@^tools/@ || $realfile =~ m@^scripts/@);
+ return ($realfile =~ m@^tools/@ ||
+ $realfile =~ m@^scripts/@ ||
+ $realfile =~ m@^arch/.*\btools\b@);
}
sub process {
--
2.55.0