s390/sclp: avoid using strncmp with hardcoded length
authorVasily Gorbik <gor@linux.ibm.com>
Mon, 19 Aug 2019 15:13:04 +0000 (17:13 +0200)
committerVasily Gorbik <gor@linux.ibm.com>
Thu, 29 Aug 2019 13:34:58 +0000 (15:34 +0200)
"earlyprintk" option documentation does not clearly state which
platform supports which additional values (e.g. ",keep"). Preserve old
option behaviour and reuse str_has_prefix instead of strncmp for prefix
testing.

Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
arch/s390/kernel/early_printk.c

index 40c1dfec944e6040c3f1402679f318250190ffb4..6f24d83bc5dc0e57e57e8eae9bf857838b0169d0 100644 (file)
@@ -25,7 +25,7 @@ static int __init setup_early_printk(char *buf)
        if (early_console)
                return 0;
        /* Accept only "earlyprintk" and "earlyprintk=sclp" */
-       if (buf && strncmp(buf, "sclp", 4))
+       if (buf && !str_has_prefix(buf, "sclp"))
                return 0;
        if (!sclp.has_linemode && !sclp.has_vt220)
                return 0;