From 2c3c1048746a4622d8c89a29670120dc8fab93c4 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 20:49:45 +0200 Subject: Adding upstream version 6.1.76. Signed-off-by: Daniel Baumann --- fs/proc/util.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 fs/proc/util.c (limited to 'fs/proc/util.c') diff --git a/fs/proc/util.c b/fs/proc/util.c new file mode 100644 index 000000000..98f8adc17 --- /dev/null +++ b/fs/proc/util.c @@ -0,0 +1,24 @@ +#include +#include "internal.h" + +unsigned name_to_int(const struct qstr *qstr) +{ + const char *name = qstr->name; + int len = qstr->len; + unsigned n = 0; + + if (len > 1 && *name == '0') + goto out; + do { + unsigned c = *name++ - '0'; + if (c > 9) + goto out; + if (n >= (~0U-9)/10) + goto out; + n *= 10; + n += c; + } while (--len > 0); + return n; +out: + return ~0U; +} -- cgit v1.2.3