All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [PATCH] vl: remove dead code in parse_memory_options()
Date: Mon, 08 Aug 2022 07:14:57 +0200	[thread overview]
Message-ID: <8735e7z57y.fsf@pond.sub.org> (raw)
In-Reply-To: <20220805172309.553441-1-pbonzini@redhat.com> (Paolo Bonzini's message of "Fri, 5 Aug 2022 19:23:09 +0200")

Paolo Bonzini <pbonzini@redhat.com> writes:

> mem_str will never be an empty string, because qemu_opt_get_size() fails
> if it encounters one:
>
>    $ ./qemu-system-x86_64 -m size=
>    qemu-system-x86_64: -m size=: Parameter size expects a non-negative number below 2^64
>    Optional suffix k, M, G, T, P or E means kilo-, mega-, giga-, tera-, peta-
>    and exabytes, respectively.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  softmmu/vl.c | 7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)
>
> diff --git a/softmmu/vl.c b/softmmu/vl.c
> index 45e919de9f..706bd7cff7 100644
> --- a/softmmu/vl.c
> +++ b/softmmu/vl.c
> @@ -1960,13 +1960,8 @@ static void parse_memory_options(void)
>      prop = qdict_new();
>  
>      if (qemu_opt_get_size(opts, "size", 0) != 0) {
> -        mem_str = qemu_opt_get(opts, "size");
> -        if (!*mem_str) {
> -            error_report("missing 'size' option value");
> -            exit(EXIT_FAILURE);
> -        }
> -
>          /* Fix up legacy suffix-less format */
> +        mem_str = qemu_opt_get(opts, "size");
>          if (g_ascii_isdigit(mem_str[strlen(mem_str) - 1])) {
>              g_autofree char *mib_str = g_strdup_printf("%sM", mem_str);
>              qdict_put_str(prop, "size", mib_str);

Reviewed-by: Markus Armbruster <armbru@redhat.com>



      reply	other threads:[~2022-08-08  5:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-05 17:23 [PATCH] vl: remove dead code in parse_memory_options() Paolo Bonzini
2022-08-08  5:14 ` Markus Armbruster [this message]

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=8735e7z57y.fsf@pond.sub.org \
    --to=armbru@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.