mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] selinux: use isdigit() in selinux_genfs_get_sid()
@ 2026-10-14 16:07 Thorsten Blum
  2026-10-15 14:01 ` Stephen Smalley
  2026-11-17 21:10 ` Paul Moore
  0 siblings, 2 replies; 4+ messages in thread
From: Thorsten Blum @ 2026-10-14 16:07 UTC (permalink / raw)
  To: Paul Moore, Stephen Smalley, Ondrej Mosnáček
  Cc: Thorsten Blum, selinux, linux-kernel

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++;
 			}

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] selinux: use isdigit() in selinux_genfs_get_sid()
  2026-10-14 16:07 [PATCH] selinux: use isdigit() in selinux_genfs_get_sid() Thorsten Blum
@ 2026-10-15 14:01 ` Stephen Smalley
  2026-10-15 14:05   ` Paul Moore
  2026-11-17 21:10 ` Paul Moore
  1 sibling, 1 reply; 4+ messages in thread
From: Stephen Smalley @ 2026-10-15 14:01 UTC (permalink / raw)
  To: Thorsten Blum
  Cc: Paul Moore, Ondrej Mosnáček, selinux, linux-kernel

On Wed, Oct 14, 2026 at 12:10 PM Thorsten Blum <blum@kernel.org> wrote:
>
> Use isdigit() to replace the open-coded implementation.
>
> Signed-off-by: Thorsten Blum <blum@kernel.org>

I seem to recall seeing this same patch possibly from someone else but
regardless:
Acked-by: Stephen Smalley <stephen.smalley.work@gmail.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] selinux: use isdigit() in selinux_genfs_get_sid()
  2026-10-15 14:01 ` Stephen Smalley
@ 2026-10-15 14:05   ` Paul Moore
  0 siblings, 0 replies; 4+ messages in thread
From: Paul Moore @ 2026-10-15 14:05 UTC (permalink / raw)
  To: Stephen Smalley
  Cc: Thorsten Blum, Ondrej Mosnáček, selinux, linux-kernel

On Thu, Oct 15, 2026 at 10:01 AM Stephen Smalley
<stephen.smalley.work@gmail.com> wrote:
> On Wed, Oct 14, 2026 at 12:10 PM Thorsten Blum <blum@kernel.org> wrote:
> >
> > Use isdigit() to replace the open-coded implementation.
> >
> > Signed-off-by: Thorsten Blum <blum@kernel.org>
>
> I seem to recall seeing this same patch possibly from someone else but
> regardless:
> Acked-by: Stephen Smalley <stephen.smalley.work@gmail.com>

https://lore.kernel.org/selinux/20260928174643.2458710-9-cgoettsche@seltendoof.de/

-- 
paul-moore.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] selinux: use isdigit() in selinux_genfs_get_sid()
  2026-10-14 16:07 [PATCH] selinux: use isdigit() in selinux_genfs_get_sid() Thorsten Blum
  2026-10-15 14:01 ` Stephen Smalley
@ 2026-11-17 21:10 ` Paul Moore
  1 sibling, 0 replies; 4+ messages in thread
From: Paul Moore @ 2026-11-17 21:10 UTC (permalink / raw)
  To: Thorsten Blum, Stephen Smalley, Ondrej Mosnáček
  Cc: Thorsten Blum, selinux, linux-kernel

On Oct 14, 2026 Thorsten Blum <blum@kernel.org> wrote:
> 
> Use isdigit() to replace the open-coded implementation.
> 
> Signed-off-by: Thorsten Blum <blum@kernel.org>
> Acked-by: Stephen Smalley <stephen.smalley.work@gmail.com>
> ---
>  security/selinux/hooks.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

As mentioned earlier, this is a partial dup of a patch that is currently
in the queue to be reviewed, however, that patch combines this change with
another unrelated change, so merging this ahead of the other patch might
be beneficial.

Merged into selinux/dev, thanks.

--
paul-moore.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-11-17 21:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-14 16:07 [PATCH] selinux: use isdigit() in selinux_genfs_get_sid() Thorsten Blum
2026-10-15 14:01 ` Stephen Smalley
2026-10-15 14:05   ` Paul Moore
2026-11-17 21:10 ` Paul Moore

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®