From d34e385dd7722641d48cc818d6dd7d8cc3856b67 Mon Sep 17 00:00:00 2001 From: zjd1988 <942002795@qq.com> Date: Tue, 12 May 2020 14:33:14 +0800 Subject: [PATCH] assert locator.device < sd.MAX_NR_DEVICE when bool(avaiable_node) = true Signed-off-by: zjd1988 <942002795@qq.com> --- src/core/impl/comp_node/cuda/comp_node.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/impl/comp_node/cuda/comp_node.cpp b/src/core/impl/comp_node/cuda/comp_node.cpp index ae296d98b..0d4b91c90 100644 --- a/src/core/impl/comp_node/cuda/comp_node.cpp +++ b/src/core/impl/comp_node/cuda/comp_node.cpp @@ -659,10 +659,10 @@ CompNode::Impl* CudaCompNode::load_cuda( if (!available_node) { mgb_assert(sd.nr_node < sd.MAX_NR_COMP_NODE, "too many CompNode allocated"); - mgb_assert(locator.device < sd.MAX_NR_COMP_NODE, - "device number too large"); available_node = &sd.node[sd.nr_node ++]; } + mgb_assert(locator.device < sd.MAX_NR_DEVICE, + "device number too large"); mgb_assert(!available_node->m_initialized); available_node->init(locator, locator_logical); -- GitLab