|
@@ -100,6 +100,8 @@
|
|
|
#include "internal.h"
|
|
|
#include "fd.h"
|
|
|
|
|
|
+#include "../../lib/kstrtox.h"
|
|
|
+
|
|
|
/* NOTE:
|
|
|
* Implementing inode permission operations in /proc is almost
|
|
|
* certainly an error. Permission checks need to happen during
|
|
@@ -1906,8 +1908,33 @@ end_instantiate:
|
|
|
static int dname_to_vma_addr(struct dentry *dentry,
|
|
|
unsigned long *start, unsigned long *end)
|
|
|
{
|
|
|
- if (sscanf(dentry->d_name.name, "%lx-%lx", start, end) != 2)
|
|
|
+ const char *str = dentry->d_name.name;
|
|
|
+ unsigned long long sval, eval;
|
|
|
+ unsigned int len;
|
|
|
+
|
|
|
+ len = _parse_integer(str, 16, &sval);
|
|
|
+ if (len & KSTRTOX_OVERFLOW)
|
|
|
+ return -EINVAL;
|
|
|
+ if (sval != (unsigned long)sval)
|
|
|
+ return -EINVAL;
|
|
|
+ str += len;
|
|
|
+
|
|
|
+ if (*str != '-')
|
|
|
return -EINVAL;
|
|
|
+ str++;
|
|
|
+
|
|
|
+ len = _parse_integer(str, 16, &eval);
|
|
|
+ if (len & KSTRTOX_OVERFLOW)
|
|
|
+ return -EINVAL;
|
|
|
+ if (eval != (unsigned long)eval)
|
|
|
+ return -EINVAL;
|
|
|
+ str += len;
|
|
|
+
|
|
|
+ if (*str != '\0')
|
|
|
+ return -EINVAL;
|
|
|
+
|
|
|
+ *start = sval;
|
|
|
+ *end = eval;
|
|
|
|
|
|
return 0;
|
|
|
}
|