qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kurz <groug@kaod.org>
To: Gavin Shan <gshan@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [PATCH] exec: Remove the duplicated check in parse_cpu_option()
Date: Fri, 6 Dec 2019 17:58:40 +0100	[thread overview]
Message-ID: <20191206175840.06507c32@bahia.w3ibm.bluemix.net> (raw)
In-Reply-To: <20191206063337.39764-1-gshan@redhat.com>

On Fri,  6 Dec 2019 17:33:37 +1100
Gavin Shan <gshan@redhat.com> wrote:

> The @cpu_option shouldn't be NULL, otherwise assertion from g_strsplit()
> should be raised as below message indicates. So it's meaningless to validate
> @model_pices[0] in parse_cpu_option() as it shouldn't be NULL either.
> 
>    qemu-system-aarch64: GLib: g_strsplit: assertion 'string != NULL' failed
> 
> This just removes the check and unused message.
> 

Hrm... the check isn't about @cpu_option being NULL. It is about filtering out
invalid syntaxes like:

-cpu ''

or

-cpu ,some-prop

> Signed-off-by: Gavin Shan <gshan@redhat.com>
> ---
>  exec.c | 5 -----
>  1 file changed, 5 deletions(-)
> 
> diff --git a/exec.c b/exec.c
> index ffdb518535..3cff459e43 100644
> --- a/exec.c
> +++ b/exec.c
> @@ -963,11 +963,6 @@ const char *parse_cpu_option(const char *cpu_option)
>      const char *cpu_type;
>  
>      model_pieces = g_strsplit(cpu_option, ",", 2);
> -    if (!model_pieces[0]) {
> -        error_report("-cpu option cannot be empty");
> -        exit(1);
> -    }
> -
>      oc = cpu_class_by_name(CPU_RESOLVING_TYPE, model_pieces[0]);
>      if (oc == NULL) {
>          error_report("unable to find CPU model '%s'", model_pieces[0]);



  reply	other threads:[~2019-12-06 18:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-06  6:33 [PATCH] exec: Remove the duplicated check in parse_cpu_option() Gavin Shan
2019-12-06 16:58 ` Greg Kurz [this message]
2019-12-07 12:56   ` Gavin Shan
2019-12-07 16:51     ` Greg Kurz
2019-12-08 21:45       ` Gavin Shan

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=20191206175840.06507c32@bahia.w3ibm.bluemix.net \
    --to=groug@kaod.org \
    --cc=gshan@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 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).