From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53131) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YYg5f-0007yW-Bq for qemu-devel@nongnu.org; Thu, 19 Mar 2015 15:26:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YYg5b-0005d0-E4 for qemu-devel@nongnu.org; Thu, 19 Mar 2015 15:26:47 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51953) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YYg5b-0005cu-6U for qemu-devel@nongnu.org; Thu, 19 Mar 2015 15:26:43 -0400 From: Eduardo Habkost Date: Thu, 19 Mar 2015 16:26:10 -0300 Message-Id: <1426793174-19012-3-git-send-email-ehabkost@redhat.com> In-Reply-To: <1426793174-19012-1-git-send-email-ehabkost@redhat.com> References: <1426793174-19012-1-git-send-email-ehabkost@redhat.com> Subject: [Qemu-devel] [PULL 2/6] numa: Reject CPU indexes > max_cpus List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: qemu-devel@nongnu.org, Paolo Bonzini , Igor Mammedov , =?UTF-8?q?Andreas=20F=C3=A4rber?= , "Michael S. Tsirkin" CPU index is always less than max_cpus, as documented at sysemu.h: > The following shall be true for all CPUs: > cpu->cpu_index < max_cpus <= MAX_CPUMASK_BITS Reject configuration which uses invalid CPU indexes. Reviewed-by: Igor Mammedov Signed-off-by: Eduardo Habkost --- numa.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/numa.c b/numa.c index 13b2f01..6b4ab0e 100644 --- a/numa.c +++ b/numa.c @@ -76,9 +76,11 @@ static void numa_node_parse(NumaNodeOptions *node, QemuOpts *opts, Error **errp) } for (cpus = node->cpus; cpus; cpus = cpus->next) { - if (cpus->value >= MAX_CPUMASK_BITS) { - error_setg(errp, "CPU number %" PRIu16 " is bigger than %d", - cpus->value, MAX_CPUMASK_BITS - 1); + if (cpus->value >= max_cpus) { + error_setg(errp, + "CPU index (%" PRIu16 ")" + " should be smaller than maxcpus (%d)", + cpus->value, max_cpus); return; } bitmap_set(numa_info[nodenr].node_cpu, cpus->value, 1); -- 2.1.0