Received: from eggs.gnu.org ([2001:4830:134:3::10]:44712) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X0MtZ-0006rl-2v for qemu-devel@nongnu.org; Thu, 26 Jun 2014 23:32:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X0MtU-0006vt-GI for qemu-devel@nongnu.org; Thu, 26 Jun 2014 23:32:13 -0400 Received: from [59.151.112.132] (port=38498 helo=heian.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X0MtU-0006sh-3j for qemu-devel@nongnu.org; Thu, 26 Jun 2014 23:32:08 -0400 Date: Fri, 27 Jun 2014 11:30:07 +0800 From: Hu Tao Message-ID: <20140627033007.GA4030@G08FNSTD100614.fnst.cn.fujitsu.com> References: <1403818400-13671-1-git-send-email-ehabkost@redhat.com> <1403818400-13671-3-git-send-email-ehabkost@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline In-Reply-To: <1403818400-13671-3-git-send-email-ehabkost@redhat.com> Subject: Re: [Qemu-devel] [PATCH 2/3] numa: Reject duplicate node IDs List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eduardo Habkost Cc: "Michael S. Tsirkin" , Alexey Kardashevskiy , Nishanth Aravamudan , qemu-devel@nongnu.org, Anton Blanchard , David Rientjes , Igor Mammedov On Thu, Jun 26, 2014 at 06:33:19PM -0300, Eduardo Habkost wrote: > The same nodeid shouldn't appear multiple times in the command-line. > > In addition to detecting command-line mistakes, this will fix a bug > where nb_numa_nodes may become larger than MAX_NODES (and cause > out-of-bounds access on the numa_info array). > > Signed-off-by: Eduardo Habkost Reviewed-by: Hu Tao This patch makes me remembering the same problem for cpus, like -numa ..cpus=1,.. -numa ..cpus=1,.., in the case one node has cpu, the other doesn't. Maybe we should eject it too. > --- > numa.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/numa.c b/numa.c > index 3de9116..e93407a 100644 > --- a/numa.c > +++ b/numa.c > @@ -62,6 +62,11 @@ static void numa_node_parse(NumaNodeOptions *node, QemuOpts *opts, Error **errp) > return; > } > > + if (numa_info[nodenr].present) { > + error_setg(errp, "Duplicate NUMA nodeid: %" PRIu16, nodenr); > + return; > + } > + > for (cpus = node->cpus; cpus; cpus = cpus->next) { > if (cpus->value > MAX_CPUMASK_BITS) { > error_setg(errp, "CPU number %" PRIu16 " is bigger than %d", > -- > 1.9.3