mm/page_table_check.c: use strtobool for param parsing
authorDr. David Alan Gilbert <linux@treblig.org>
Tue, 22 Mar 2022 21:48:04 +0000 (14:48 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 22 Mar 2022 22:57:11 +0000 (15:57 -0700)
Use strtobool rather than open coding "on" and "off" parsing.

Link: https://lkml.kernel.org/r/20220227181038.126926-1-linux@treblig.org
Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/page_table_check.c

index 3763bd0..2458281 100644 (file)
@@ -23,15 +23,7 @@ EXPORT_SYMBOL(page_table_check_disabled);
 
 static int __init early_page_table_check_param(char *buf)
 {
-       if (!buf)
-               return -EINVAL;
-
-       if (strcmp(buf, "on") == 0)
-               __page_table_check_enabled = true;
-       else if (strcmp(buf, "off") == 0)
-               __page_table_check_enabled = false;
-
-       return 0;
+       return strtobool(buf, &__page_table_check_enabled);
 }
 
 early_param("page_table_check", early_page_table_check_param);