diff mbox series

[PULL,19/24] bsd-user: use qemu_strtol in preference to strtol

Message ID 20210423203959.78275-10-imp@bsdimp.com (mailing list archive)
State New, archived
Headers show
Series [PULL,01/24] bsd-user: whitespace changes | expand

Commit Message

Warner Losh April 23, 2021, 8:39 p.m. UTC
From: Warner Losh <imp@bsdimp.com>

Signed-off-by: Warner Losh <imp@bsdimp.com>
---
 bsd-user/main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Philippe Mathieu-Daudé April 23, 2021, 9:16 p.m. UTC | #1
On 4/23/21 10:39 PM, imp@bsdimp.com wrote:
> From: Warner Losh <imp@bsdimp.com>
> 
> Signed-off-by: Warner Losh <imp@bsdimp.com>
> ---
>  bsd-user/main.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/bsd-user/main.c b/bsd-user/main.c
> index 69e5525607..95fda8c5ae 100644
> --- a/bsd-user/main.c
> +++ b/bsd-user/main.c
> @@ -821,7 +821,7 @@ int main(int argc, char **argv)
>              }
>          } else if (!strcmp(r, "s")) {
>              r = argv[optind++];
> -            x86_stack_size = strtol(r, (char **)&r, 0);
> +            x86_stack_size = qemu_strtol(r, (char **)&r, 0);
>              if (x86_stack_size <= 0) {
>                  usage();
>              }
> @@ -853,7 +853,7 @@ int main(int argc, char **argv)
>                  exit(1);
>              }
>          } else if (!strcmp(r, "B")) {
> -            guest_base = strtol(argv[optind++], NULL, 0);
> +            guest_base = qemu_strtol(argv[optind++], NULL, 0);

Missing error check (-EINVAL & -ERANGE).

>              have_guest_base = true;
>          } else if (!strcmp(r, "drop-ld-preload")) {
>              (void) envlist_unsetenv(envlist, "LD_PRELOAD");
>
Warner Losh April 23, 2021, 9:21 p.m. UTC | #2
On Fri, Apr 23, 2021 at 3:16 PM Philippe Mathieu-Daudé <f4bug@amsat.org>
wrote:

> On 4/23/21 10:39 PM, imp@bsdimp.com wrote:
> > From: Warner Losh <imp@bsdimp.com>
> >
> > Signed-off-by: Warner Losh <imp@bsdimp.com>
> > ---
> >  bsd-user/main.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/bsd-user/main.c b/bsd-user/main.c
> > index 69e5525607..95fda8c5ae 100644
> > --- a/bsd-user/main.c
> > +++ b/bsd-user/main.c
> > @@ -821,7 +821,7 @@ int main(int argc, char **argv)
> >              }
> >          } else if (!strcmp(r, "s")) {
> >              r = argv[optind++];
> > -            x86_stack_size = strtol(r, (char **)&r, 0);
> > +            x86_stack_size = qemu_strtol(r, (char **)&r, 0);
> >              if (x86_stack_size <= 0) {
> >                  usage();
> >              }
> > @@ -853,7 +853,7 @@ int main(int argc, char **argv)
> >                  exit(1);
> >              }
> >          } else if (!strcmp(r, "B")) {
> > -            guest_base = strtol(argv[optind++], NULL, 0);
> > +            guest_base = qemu_strtol(argv[optind++], NULL, 0);
>
> Missing error check (-EINVAL & -ERANGE).
>

Thanks! Will update.


> >              have_guest_base = true;
> >          } else if (!strcmp(r, "drop-ld-preload")) {
> >              (void) envlist_unsetenv(envlist, "LD_PRELOAD");
> >
>
>
diff mbox series

Patch

diff --git a/bsd-user/main.c b/bsd-user/main.c
index 69e5525607..95fda8c5ae 100644
--- a/bsd-user/main.c
+++ b/bsd-user/main.c
@@ -821,7 +821,7 @@  int main(int argc, char **argv)
             }
         } else if (!strcmp(r, "s")) {
             r = argv[optind++];
-            x86_stack_size = strtol(r, (char **)&r, 0);
+            x86_stack_size = qemu_strtol(r, (char **)&r, 0);
             if (x86_stack_size <= 0) {
                 usage();
             }
@@ -853,7 +853,7 @@  int main(int argc, char **argv)
                 exit(1);
             }
         } else if (!strcmp(r, "B")) {
-            guest_base = strtol(argv[optind++], NULL, 0);
+            guest_base = qemu_strtol(argv[optind++], NULL, 0);
             have_guest_base = true;
         } else if (!strcmp(r, "drop-ld-preload")) {
             (void) envlist_unsetenv(envlist, "LD_PRELOAD");