The decompressor has a copy of kstrtobool() that takes only y/n, 1/0 and
on/off. The kernel's kstrtobool() also takes true/false since 0d6ea3ac94ca
("lib/kstrtox.c: add "false"/"true" support to kstrtobool()") and
enabled/disabled since ae5b3500856f ("kstrtox: add support for enabled and
disabled in kstrtobool()").

The decompressor ignores these values, so "cmma=false" leaves CMMA enabled
and "prot_virt=true" does not enable it.

Copy kstrtobool() from lib/kstrtox.c. This also adds the break after the
on/off switch, which only replaces a fall through to the empty default
case.

Signed-off-by: Mike Rapoport (Microsoft) <[email protected]>
---
 arch/s390/boot/string.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/arch/s390/boot/string.c b/arch/s390/boot/string.c
index e4ad196cb720..c12fee2670e3 100644
--- a/arch/s390/boot/string.c
+++ b/arch/s390/boot/string.c
@@ -132,13 +132,21 @@ int kstrtobool(const char *s, bool *res)
                return -EINVAL;
 
        switch (s[0]) {
+       case 'e':
+       case 'E':
        case 'y':
        case 'Y':
+       case 't':
+       case 'T':
        case '1':
                *res = true;
                return 0;
+       case 'd':
+       case 'D':
        case 'n':
        case 'N':
+       case 'f':
+       case 'F':
        case '0':
                *res = false;
                return 0;
@@ -156,6 +164,7 @@ int kstrtobool(const char *s, bool *res)
                default:
                        break;
                }
+               break;
        default:
                break;
        }

-- 
2.53.0


Reply via email to