From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:46032) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ttj6w-0001Tr-BB for qemu-devel@nongnu.org; Fri, 11 Jan 2013 13:13:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ttj6p-00031s-Q3 for qemu-devel@nongnu.org; Fri, 11 Jan 2013 13:13:46 -0500 Received: from mx1.redhat.com ([209.132.183.28]:14712) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ttj6p-00031S-IM for qemu-devel@nongnu.org; Fri, 11 Jan 2013 13:13:39 -0500 From: Eduardo Habkost Date: Fri, 11 Jan 2013 16:15:02 -0200 Message-Id: <1357928108-21066-5-git-send-email-ehabkost@redhat.com> In-Reply-To: <1357928108-21066-1-git-send-email-ehabkost@redhat.com> References: <1357928108-21066-1-git-send-email-ehabkost@redhat.com> Subject: [Qemu-devel] [PATCH 04/10] vl.c: Check for NUMA node limit inside numa_node_add() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: libvir-list@redhat.com, Chegu Vinod , Anthony Liguori Instead of checking the limit before calling numa_add(), check the limit only when we already know we're going to add a new node. Signed-off-by: Eduardo Habkost --- vl.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/vl.c b/vl.c index 94cc6fd..2c3bbb9 100644 --- a/vl.c +++ b/vl.c @@ -1061,6 +1061,11 @@ static void numa_node_add(const char *optarg) value = endvalue = 0ULL; + if (nb_numa_nodes >= MAX_NODES) { + fprintf(stderr, "qemu: too many NUMA nodes\n"); + exit(1); + } + if (get_param_value(option, 128, "nodeid", optarg) == 0) { nodenr = nb_numa_nodes; } else { @@ -2762,10 +2767,6 @@ int main(int argc, char **argv, char **envp) } break; case QEMU_OPTION_numa: - if (nb_numa_nodes >= MAX_NODES) { - fprintf(stderr, "qemu: too many NUMA nodes\n"); - exit(1); - } numa_add(optarg); break; case QEMU_OPTION_display: -- 1.7.11.7