aboutsummaryrefslogtreecommitdiffstats
path: root/lib/string.c
diff options
context:
space:
mode:
authorKees Cook <[email protected]>2016-03-17 21:22:50 +0000
committerLinus Torvalds <[email protected]>2016-03-17 22:09:34 +0000
commitef951599074ba4fad2d0efa0a977129b41e6d203 (patch)
treedcbd4d37ac7bb455efe788b9df90d24632bbfa25 /lib/string.c
parentinclude/linux/unaligned: force inlining of byteswap operations (diff)
downloadkernel-ef951599074ba4fad2d0efa0a977129b41e6d203.tar.gz
kernel-ef951599074ba4fad2d0efa0a977129b41e6d203.zip
lib: move strtobool() to kstrtobool()
Create the kstrtobool_from_user() helper and move strtobool() logic into the new kstrtobool() (matching all the other kstrto* functions). Provides an inline wrapper for existing strtobool() callers. Signed-off-by: Kees Cook <[email protected]> Cc: Joe Perches <[email protected]> Cc: Andy Shevchenko <[email protected]> Cc: Rasmus Villemoes <[email protected]> Cc: Daniel Borkmann <[email protected]> Cc: Amitkumar Karwar <[email protected]> Cc: Nishant Sarmukadam <[email protected]> Cc: Kalle Valo <[email protected]> Cc: Steve French <[email protected]> Cc: Michael Ellerman <[email protected]> Cc: Heiko Carstens <[email protected]> Cc: Martin Schwidefsky <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
Diffstat (limited to 'lib/string.c')
-rw-r--r--lib/string.c29
1 files changed, 0 insertions, 29 deletions
diff --git a/lib/string.c b/lib/string.c
index e9c9db161d2c..ed83562a53ae 100644
--- a/lib/string.c
+++ b/lib/string.c
@@ -656,35 +656,6 @@ int match_string(const char * const *array, size_t n, const char *string)
}
EXPORT_SYMBOL(match_string);
-/**
- * strtobool - convert common user inputs into boolean values
- * @s: input string
- * @res: result
- *
- * This routine returns 0 iff the first character is one of 'Yy1Nn0'.
- * Otherwise it will return -EINVAL. Value pointed to by res is
- * updated upon finding a match.
- */
-int strtobool(const char *s, bool *res)
-{
- switch (s[0]) {
- case 'y':
- case 'Y':
- case '1':
- *res = true;
- break;
- case 'n':
- case 'N':
- case '0':
- *res = false;
- break;
- default:
- return -EINVAL;
- }
- return 0;
-}
-EXPORT_SYMBOL(strtobool);
-
#ifndef __HAVE_ARCH_MEMSET
/**
* memset - Fill a region of memory with the given value