]> Git Repo - qemu.git/commitdiff
hw/i386/pc: fix regression in parsing vga cmdline parameter
authorPeter Wu <[email protected]>
Sat, 21 Dec 2019 16:21:24 +0000 (17:21 +0100)
committerPaolo Bonzini <[email protected]>
Tue, 7 Jan 2020 11:08:39 +0000 (12:08 +0100)
When the 'vga=' parameter is succeeded by another parameter, QEMU 4.2.0
would refuse to start with a rather cryptic message:

    $ qemu-system-x86_64 -kernel /boot/vmlinuz-linux -append 'vga=792 quiet'
    qemu: can't parse 'vga' parameter: Invalid argument

It was not clear whether this applied to the '-vga std' parameter or the
'-append' one. Fix the parsing regression and clarify the error.

Fixes: 133ef074bd ("hw/i386/pc: replace use of strtol with qemu_strtoui in x86_load_linux()")
Cc: Sergio Lopez <[email protected]>
Signed-off-by: Peter Wu <[email protected]>
Message-Id: <20191221162124.1159291[email protected]>
Cc: [email protected]
Signed-off-by: Paolo Bonzini <[email protected]>
hw/i386/x86.c

index d8bb5c2a960420400c616fa6707b5d7121c1cd34..9b9a4d583729dbce766301b92b6e1ac85e214cab 100644 (file)
@@ -612,6 +612,7 @@ void x86_load_linux(X86MachineState *x86ms,
     vmode = strstr(kernel_cmdline, "vga=");
     if (vmode) {
         unsigned int video_mode;
+        const char *end;
         int ret;
         /* skip "vga=" */
         vmode += 4;
@@ -622,10 +623,9 @@ void x86_load_linux(X86MachineState *x86ms,
         } else if (!strncmp(vmode, "ask", 3)) {
             video_mode = 0xfffd;
         } else {
-            ret = qemu_strtoui(vmode, NULL, 0, &video_mode);
-            if (ret != 0) {
-                fprintf(stderr, "qemu: can't parse 'vga' parameter: %s\n",
-                        strerror(-ret));
+            ret = qemu_strtoui(vmode, &end, 0, &video_mode);
+            if (ret != 0 || (*end && *end != ' ')) {
+                fprintf(stderr, "qemu: invalid 'vga=' kernel parameter.\n");
                 exit(1);
             }
         }
This page took 0.029649 seconds and 4 git commands to generate.