From: Thorsten Blum <blum@kernel.org>
To: "Paul Moore" <paul@paul-moore.com>,
"Stephen Smalley" <stephen.smalley.work@gmail.com>,
"Ondrej Mosnáček" <omosnacek@gmail.com>
Cc: Thorsten Blum <blum@kernel.org>,
selinux@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] selinux: use isdigit() in selinux_genfs_get_sid()
Date: Wed, 14 Oct 2026 18:07:43 +0200 [thread overview]
Message-ID: <20261014160741.222219-3-blum@kernel.org> (raw)
Use isdigit() to replace the open-coded implementation.
Signed-off-by: Thorsten Blum <blum@kernel.org>
---
security/selinux/hooks.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index 30776b0107f2..d1304afa42fd 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -31,6 +31,7 @@
#include <linux/lsm_hooks.h>
#include <linux/xattr.h>
#include <linux/capability.h>
+#include <linux/ctype.h>
#include <linux/unistd.h>
#include <linux/mm.h>
#include <linux/mman.h>
@@ -1357,7 +1358,7 @@ static int selinux_genfs_get_sid(struct dentry *dentry,
/* each process gets a /proc/PID/ entry. Strip off the
* PID part to get a valid selinux labeling.
* e.g. /proc/1/net/rpc/nfs -> /net/rpc/nfs */
- while (path[1] >= '0' && path[1] <= '9') {
+ while (isdigit(path[1])) {
path[1] = '/';
path++;
}
next reply other threads:[~2026-10-14 16:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-14 16:07 Thorsten Blum [this message]
2026-10-15 14:01 ` Stephen Smalley
2026-10-15 14:05 ` Paul Moore
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261014160741.222219-3-blum@kernel.org \
--to=blum@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=omosnacek@gmail.com \
--cc=paul@paul-moore.com \
--cc=selinux@vger.kernel.org \
--cc=stephen.smalley.work@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®