[libvirt] [PATCH 1/5] virDomainNumaGetNodeDistance: Fix input arguments validation

Michal Privoznik mprivozn at redhat.com
Tue Nov 14 14:47:36 UTC 2017


There's no point in checking if numa->mem_nodes[node].ndistances
is set if we check for numa->mem_nodes[node].distances. However,
it makes sense to check if the sibling node caller passed falls
within boundaries.

Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
---
 src/conf/numa_conf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/conf/numa_conf.c b/src/conf/numa_conf.c
index 7bba4120b..5f0b3f9ed 100644
--- a/src/conf/numa_conf.c
+++ b/src/conf/numa_conf.c
@@ -1154,7 +1154,7 @@ virDomainNumaGetNodeDistance(virDomainNumaPtr numa,
      */
     if (!distances ||
         !distances[cellid].value ||
-        !numa->mem_nodes[node].ndistances)
+        node >= numa->nmem_nodes)
         return (node == cellid) ? LOCAL_DISTANCE : REMOTE_DISTANCE;
 
     return distances[cellid].value;
-- 
2.13.6




More information about the libvir-list mailing list