[PATCH] tomoyo: Use isdigit() in tomoyo_numscan()

Thorsten Blum blum at kernel.org
Wed Oct 14 16:55:32 UTC 2026


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

Signed-off-by: Thorsten Blum <blum at kernel.org>
---
 security/tomoyo/common.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/security/tomoyo/common.c b/security/tomoyo/common.c
index fdaeaff01fc1..031c643ce22c 100644
--- a/security/tomoyo/common.c
+++ b/security/tomoyo/common.c
@@ -5,6 +5,7 @@
  * Copyright (C) 2005-2011  NTT DATA CORPORATION
  */
 
+#include <linux/ctype.h>
 #include <linux/uaccess.h>
 #include <linux/slab.h>
 #include <linux/security.h>
@@ -2030,7 +2031,7 @@ static bool tomoyo_numscan(const char *str, const char *head, int *width, const
 
 	if (!strncmp(str, head, n)) {
 		cp = str + n;
-		while (*cp && *cp >= '0' && *cp <= '9')
+		while (*cp && isdigit(*cp))
 			cp++;
 		if (*cp == tail || !tail) {
 			*width = cp - (str + n);



More information about the Linux-security-module-archive mailing list