qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v10 04/15] hw/i386/pc: replace use of strtol with qemu_strtou


From: Marc-André Lureau
Subject: Re: [PATCH v10 04/15] hw/i386/pc: replace use of strtol with qemu_strtoui in x86_load_linux()
Date: Wed, 16 Oct 2019 17:02:21 +0200

On Wed, Oct 16, 2019 at 12:16 PM Sergio Lopez <address@hidden> wrote:
>
> Follow checkpatch.pl recommendation and replace the use of strtol with
> qemu_strtoui in x86_load_linux().
>
> Signed-off-by: Sergio Lopez <address@hidden>
> Reviewed-by: Philippe Mathieu-Daudé <address@hidden>

Reviewed-by: Marc-André Lureau <address@hidden>


> ---
>  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
>
>


--
Marc-André Lureau



reply via email to

[Prev in Thread] Current Thread [Next in Thread]