Skip to contentSkip to conversation

selinux: use isdigit() in selinux_genfs_get_sid()

PATCH RESEND New Thorsten Blum 2 participants 2 messages Nov 11 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 selinux: use isdigit() in selinux_genfs_get_sid()

Use isdigit() to replace the open-coded implementation.

---
 security/selinux/hooks.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
security/selinux/hooks.c +2 -1
index 9950f89dfaa2..a6ef4083e671 100644
@@ -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++;
 			}