From nobody Thu May 2 00:21:18 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1576945478; cv=none; d=zohomail.com; s=zohoarc; b=hZmYriOh64FB1vFxRCIrYtXoiha4JwzX2pNU0Cn1VnPS7hqetgkGYTUiKnu7Gq0VEN8cQQSD3u7XGH0RMSKw+Oo79QXtIpAE4jPjIXt9U2DL1D2GmiGQeVYjC2ZroVWcqSvav9zHkx/13IWO6Cs+SF+LE8w9z4sDeVfmj1ZSGho= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576945478; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=0ISQZaogL7p0l6Pcf319hHDRm/Mr9e12UiuUyUubt9k=; b=PJwGAhprlC+HmIZFMaIWjlBbHh+H1SxoYOoI3OAMNKookobikqZnMFDfPMwjmUtkS9AWKbMVs7Q1fkDfWpH97Rdxdl2TSm6MULhYaL9mJmQha2eY3Cok3+vc+FAbvOimvpW2ZOo6yjZMkRiDJB+v4k3NLlMhMvOiqokBLzqgKh8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576945477738524.6065487183412; Sat, 21 Dec 2019 08:24:37 -0800 (PST) Received: from localhost ([::1]:40526 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iihYS-0007fw-EV for importer@patchew.org; Sat, 21 Dec 2019 11:24:36 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56441) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iihVW-0006D6-1i for qemu-devel@nongnu.org; Sat, 21 Dec 2019 11:21:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iihVU-0003iy-1g for qemu-devel@nongnu.org; Sat, 21 Dec 2019 11:21:33 -0500 Received: from mail.lekensteyn.nl ([2a02:2308::360:1:25]:55261) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iihVT-0003UU-GW for qemu-devel@nongnu.org; Sat, 21 Dec 2019 11:21:31 -0500 Received: by lekensteyn.nl with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1iihVO-0005LB-W3; Sat, 21 Dec 2019 17:21:27 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lekensteyn.nl; s=s2048-2015-q1; h=Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Subject:Cc:To:From; bh=0ISQZaogL7p0l6Pcf319hHDRm/Mr9e12UiuUyUubt9k=; b=VJYeFlYd2mi5Nur8d5RjUHWevgmN+adLZc1GGphFbIHvW3ok5KbuaxGXW1k6ewzfwkGZTbItgjmqdmqqVTFmm1e/zpynrzZQoU0oEQCGHZAuQsG1TU4MeYbuAeMMIkZCsRLsSH54N/QdVzbOxogZ2xJW8lSgkxDqirfs3PQmnluCrjADSz6Brjff4PuTo/ZCpJ0Uuw8YaX38OBvwudkcDya8r7gxjWbMhSAY6D8g9rc6XbSv58HRQReNvUnZBPQdDy1hhBnkTfV4AEL/AO6g1ZmutMW9zHXrSswTh3t7VJ2BaIwPe/WSCyK4gdKabtuS/3qSShwrJB9vUOfdCU8caw==; From: Peter Wu To: qemu-devel@nongnu.org Subject: [PATCH] hw/i386/pc: fix regression in parsing vga cmdline parameter Date: Sat, 21 Dec 2019 17:21:24 +0100 Message-Id: <20191221162124.1159291-1-peter@lekensteyn.nl> X-Mailer: git-send-email 2.24.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a02:2308::360:1:25 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Sergio Lopez , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" When the 'vga=3D' 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=3D792 qui= et' 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 Signed-off-by: Peter Wu --- Hi, This fixes a regression in QEMU 4.2.0 where my existing scripts would fail to boot while it worked fine with QEMU 4.1.1. I do wonder whether QEMU has any business in strictly enforcing the contents of the kernel command line. Perhaps it should only warn about the issue, and not exit? Previously it would silently ignore bad values. Kind regards, Peter --- hw/i386/x86.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/i386/x86.c b/hw/i386/x86.c index 394edc2f72..121650ae51 100644 --- a/hw/i386/x86.c +++ b/hw/i386/x86.c @@ -508,6 +508,7 @@ void x86_load_linux(X86MachineState *x86ms, vmode =3D strstr(kernel_cmdline, "vga=3D"); if (vmode) { unsigned int video_mode; + const char *end; int ret; /* skip "vga=3D" */ vmode +=3D 4; @@ -518,10 +519,9 @@ void x86_load_linux(X86MachineState *x86ms, } else if (!strncmp(vmode, "ask", 3)) { video_mode =3D 0xfffd; } else { - ret =3D qemu_strtoui(vmode, NULL, 0, &video_mode); - if (ret !=3D 0) { - fprintf(stderr, "qemu: can't parse 'vga' parameter: %s\n", - strerror(-ret)); + ret =3D qemu_strtoui(vmode, &end, 0, &video_mode); + if (ret !=3D 0 || (*end && *end !=3D ' ')) { + fprintf(stderr, "qemu: invalid 'vga=3D' kernel parameter.\= n"); exit(1); } } --=20 2.24.1