From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59443) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XoGXB-00064H-Az for qemu-devel@nongnu.org; Tue, 11 Nov 2014 13:51:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XoGX5-00050w-1I for qemu-devel@nongnu.org; Tue, 11 Nov 2014 13:51:21 -0500 Received: from mx1.redhat.com ([209.132.183.28]:49716) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XoGX4-00050e-Pg for qemu-devel@nongnu.org; Tue, 11 Nov 2014 13:51:14 -0500 From: Eduardo Habkost Date: Tue, 11 Nov 2014 16:50:55 -0200 Message-Id: <1415731856-14121-3-git-send-email-ehabkost@redhat.com> In-Reply-To: <1415731856-14121-1-git-send-email-ehabkost@redhat.com> References: <1415731856-14121-1-git-send-email-ehabkost@redhat.com> Subject: [Qemu-devel] [PATCH v2 2/3] vl: fix max_cpus check List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Andrew Jones , Peter Lieven From: Andrew Jones 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 Reviewed-by: Eduardo Habkost Signed-off-by: Eduardo Habkost --- vl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vl.c b/vl.c index c1bfc9b..2ed8b07 100644 --- a/vl.c +++ b/vl.c @@ -3901,9 +3901,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