Blame view

fs/proc/util.c 383 Bytes
3ee2a1990   Alexey Dobriyan   proc: : uninline ...
1
  #include <linux/dcache.h>
81966d834   Eric Biggers   fs/proc/util.c: i...
2
  #include "internal.h"
3ee2a1990   Alexey Dobriyan   proc: : uninline ...
3
4
5
6
7
8
9
10
11
  
  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;
0746a0bc6   Alexey Dobriyan   proc: use do-whil...
12
  	do {
3ee2a1990   Alexey Dobriyan   proc: : uninline ...
13
14
15
16
17
18
19
  		unsigned c = *name++ - '0';
  		if (c > 9)
  			goto out;
  		if (n >= (~0U-9)/10)
  			goto out;
  		n *= 10;
  		n += c;
0746a0bc6   Alexey Dobriyan   proc: use do-whil...
20
  	} while (--len > 0);
3ee2a1990   Alexey Dobriyan   proc: : uninline ...
21
22
23
24
  	return n;
  out:
  	return ~0U;
  }