mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-27 22:24:11 +08:00
81966d8349
name_to_int() is defined in fs/proc/util.c and declared in fs/proc/internal.h, but the declaration isn't included at the point of the definition. Include the header to enforce that the definition matches the declaration. This addresses a gcc warning when -Wmissing-prototypes is enabled. Link: http://lkml.kernel.org/r/20181115001833.49371-1-ebiggers@kernel.org Signed-off-by: Eric Biggers <ebiggers@google.com> Reviewed-by: Alexey Dobriyan <adobriyan@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
25 lines
383 B
C
25 lines
383 B
C
#include <linux/dcache.h>
|
|
#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;
|
|
}
|