diff mbox

[1/3] vl: fix max_cpus check

Message ID 1415376280-14130-2-git-send-email-drjones@redhat.com
State Superseded
Headers show

Commit Message

Andrew Jones Nov. 7, 2014, 4:04 p.m. UTC
We should confirm max_cpus, which is >= smp_cpus, is
<= the machine's true max_cpus, not just smp_cpus.

Signed-off-by: Andrew Jones <drjones@redhat.com>
---
 vl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Eduardo Habkost Nov. 7, 2014, 4:58 p.m. UTC | #1
On Fri, Nov 07, 2014 at 05:04:38PM +0100, Andrew Jones wrote:
> We should confirm max_cpus, which is >= smp_cpus, is
> <= the machine's true max_cpus, not just smp_cpus.
> 
> Signed-off-by: Andrew Jones <drjones@redhat.com>

Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>

I was sure I had fixed this before. But it looks like my patches were silently
ignored, and I forgot to ping about them.

See:

  Date: Thu, 5 Jun 2014 19:18:42 -0300
  From: Eduardo Habkost <ehabkost@redhat.com>
  Message-ID: <20140605221842.GI15000@otherpad.lan.raisama.net>
  Subject: [Qemu-devel] [PATCH] vl.c: Check -smp option ranges before setting int globals

and:

  Date: Wed, 14 May 2014 16:18:42 -0300
  From: Eduardo Habkost <ehabkost@redhat.com>
  Message-Id: <1400095122-24736-1-git-send-email-ehabkost@redhat.com>
  Subject: [Qemu-devel] [PATCH v2 RESEND] vl.c: Unify MAX_CPUMASK_BITS and machine->max_cpus checks



> ---
>  vl.c | 6 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/vl.c b/vl.c
> index f4a6e5e05bce2..9d9855092ab4a 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -3903,9 +3903,9 @@ int main(int argc, char **argv, char **envp)
>      smp_parse(qemu_opts_find(qemu_find_opts("smp-opts"), NULL));
>  
>      machine_class->max_cpus = machine_class->max_cpus ?: 1; /* Default to UP */
> -    if (smp_cpus > machine_class->max_cpus) {
> +    if (max_cpus > machine_class->max_cpus) {
>          fprintf(stderr, "Number of SMP cpus requested (%d), exceeds max cpus "
> -                "supported by machine `%s' (%d)\n", smp_cpus,
> +                "supported by machine `%s' (%d)\n", max_cpus,
>                  machine_class->name, machine_class->max_cpus);
>          exit(1);
>      }
> -- 
> 1.9.3
>
diff mbox

Patch

diff --git a/vl.c b/vl.c
index f4a6e5e05bce2..9d9855092ab4a 100644
--- a/vl.c
+++ b/vl.c
@@ -3903,9 +3903,9 @@  int main(int argc, char **argv, char **envp)
     smp_parse(qemu_opts_find(qemu_find_opts("smp-opts"), NULL));
 
     machine_class->max_cpus = machine_class->max_cpus ?: 1; /* Default to UP */
-    if (smp_cpus > machine_class->max_cpus) {
+    if (max_cpus > machine_class->max_cpus) {
         fprintf(stderr, "Number of SMP cpus requested (%d), exceeds max cpus "
-                "supported by machine `%s' (%d)\n", smp_cpus,
+                "supported by machine `%s' (%d)\n", max_cpus,
                 machine_class->name, machine_class->max_cpus);
         exit(1);
     }