From: Sergio Lopez <slp@redhat.com>
To: qemu-devel@nongnu.org
Cc: berrange@redhat.com, ehabkost@redhat.com,
"Sergio Lopez" <slp@redhat.com>,
mst@redhat.com, lersek@redhat.com, groug@kaod.org,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
marcandre.lureau@gmail.com, kraxel@redhat.com,
pbonzini@redhat.com, imammedo@redhat.com, sgarzare@redhat.com,
philmd@redhat.com, rth@twiddle.net
Subject: [PATCH v11 04/15] hw/i386/pc: replace use of strtol with qemu_strtoui in x86_load_linux()
Date: Fri, 18 Oct 2019 12:53:04 +0200 [thread overview]
Message-ID: <20191018105315.27511-5-slp@redhat.com> (raw)
In-Reply-To: <20191018105315.27511-1-slp@redhat.com>
Follow checkpatch.pl recommendation and replace the use of strtol with
qemu_strtoui in x86_load_linux().
Signed-off-by: Sergio Lopez <slp@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
hw/i386/pc.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 77e86bfc3d..c8608b8007 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -68,6 +68,7 @@
#include "qemu/config-file.h"
#include "qemu/error-report.h"
#include "qemu/option.h"
+#include "qemu/cutils.h"
#include "hw/acpi/acpi.h"
#include "hw/acpi/cpu_hotplug.h"
#include "hw/boards.h"
@@ -1202,6 +1203,7 @@ static void x86_load_linux(PCMachineState *pcms,
vmode = strstr(kernel_cmdline, "vga=");
if (vmode) {
unsigned int video_mode;
+ int ret;
/* skip "vga=" */
vmode += 4;
if (!strncmp(vmode, "normal", 6)) {
@@ -1211,7 +1213,12 @@ static void x86_load_linux(PCMachineState *pcms,
} else if (!strncmp(vmode, "ask", 3)) {
video_mode = 0xfffd;
} else {
- video_mode = strtol(vmode, NULL, 0);
+ ret = qemu_strtoui(vmode, NULL, 0, &video_mode);
+ if (ret != 0) {
+ fprintf(stderr, "qemu: can't parse 'vga' parameter: %s\n",
+ strerror(-ret));
+ exit(1);
+ }
}
stw_p(header + 0x1fa, video_mode);
}
--
2.21.0
next prev parent reply other threads:[~2019-10-18 10:58 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-18 10:53 [PATCH v11 00/15] Introduce the microvm machine type Sergio Lopez
2019-10-18 10:53 ` [PATCH v11 01/15] hw/virtio: Factorize virtio-mmio headers Sergio Lopez
2019-10-18 10:53 ` [PATCH v11 02/15] hw/i386/pc: rename functions shared with non-PC machines Sergio Lopez
2019-10-18 10:53 ` [PATCH v11 03/15] hw/i386/pc: fix code style issues on functions that will be moved out Sergio Lopez
2019-10-18 10:53 ` Sergio Lopez [this message]
2019-10-18 10:53 ` [PATCH v11 05/15] hw/i386/pc: avoid an assignment in if condition in x86_load_linux() Sergio Lopez
2019-10-18 10:53 ` [PATCH v11 06/15] hw/i386/pc: remove commented out code from x86_load_linux() Sergio Lopez
2019-10-18 10:53 ` [PATCH v11 07/15] hw/i386/pc: move shared x86 functions to x86.c and export them Sergio Lopez
2019-10-18 10:53 ` [PATCH v11 08/15] hw/i386: split PCMachineState deriving X86MachineState from it Sergio Lopez
2019-10-18 10:53 ` [PATCH v11 09/15] hw/i386: make x86.c independent from PCMachineState Sergio Lopez
2019-10-18 10:53 ` [PATCH v11 10/15] fw_cfg: add "modify" functions for all types Sergio Lopez
2019-10-18 10:53 ` [PATCH v11 11/15] hw/intc/apic: reject pic ints if isa_pic == NULL Sergio Lopez
2019-10-18 10:53 ` [PATCH v11 12/15] roms: add microvm-bios (qboot) as binary and git submodule Sergio Lopez
2019-10-18 10:53 ` [PATCH v11 13/15] docs/microvm.rst: document the new microvm machine type Sergio Lopez
2019-10-18 10:53 ` [PATCH v11 14/15] hw/i386: Introduce the " Sergio Lopez
2019-10-30 9:25 ` Philippe Mathieu-Daudé
2019-10-30 14:18 ` Paolo Bonzini
2019-10-18 10:53 ` [PATCH v11 15/15] MAINTAINERS: add microvm related files Sergio Lopez
2019-11-27 15:41 ` [PATCH v11 00/15] Introduce the microvm machine type Markus Armbruster
2019-12-02 13:01 ` Sergio Lopez
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191018105315.27511-5-slp@redhat.com \
--to=slp@redhat.com \
--cc=berrange@redhat.com \
--cc=ehabkost@redhat.com \
--cc=groug@kaod.org \
--cc=imammedo@redhat.com \
--cc=kraxel@redhat.com \
--cc=lersek@redhat.com \
--cc=marcandre.lureau@gmail.com \
--cc=marcandre.lureau@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=philmd@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
--cc=sgarzare@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).