Skip to contentSkip to conversation

tomoyo: Use isdigit() in tomoyo_numscan()

PATCH In review Thorsten Blum 3 participants 3 messages Oct 14 – Nov 4

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tomoyo: Use isdigit() in tomoyo_numscan()

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

---
 security/tomoyo/common.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
security/tomoyo/common.c +2 -1
index fdaeaff01fc1..031c643ce22c 100644
@@ -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);
#1 lore raw
Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 3 lines

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

Sashiko has reviewed this patch and found no issues. It looks great!

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1