s390/startup: correct command line options parsing
authorVasily Gorbik <gor@linux.ibm.com>
Mon, 19 Aug 2019 08:49:53 +0000 (10:49 +0200)
committerVasily Gorbik <gor@linux.ibm.com>
Mon, 26 Aug 2019 10:51:17 +0000 (12:51 +0200)
Check val is not NULL before accessing it. This might happen if
corresponding kernel command line options are used without specifying
values.

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

index 4a052a844f9be43a542a74aeb0ec6305d517fb9e..80b8d8712f082812c257e56a1cc58c6623b8c08d 100644 (file)
@@ -223,12 +223,12 @@ void parse_boot_command_line(void)
        while (*args) {
                args = next_arg(args, &param, &val);
 
-               if (!strcmp(param, "mem")) {
+               if (!strcmp(param, "mem") && val) {
                        memory_end = round_down(memparse(val, NULL), PAGE_SIZE);
                        memory_end_set = 1;
                }
 
-               if (!strcmp(param, "vmalloc"))
+               if (!strcmp(param, "vmalloc") && val)
                        vmalloc_size = round_up(memparse(val, NULL), PAGE_SIZE);
 
                if (!strcmp(param, "noexec")) {
@@ -237,7 +237,7 @@ void parse_boot_command_line(void)
                                noexec_disabled = 1;
                }
 
-               if (!strcmp(param, "facilities"))
+               if (!strcmp(param, "facilities") && val)
                        modify_fac_list(val);
 
                if (!strcmp(param, "nokaslr"))