render / rpms / libvirt

Forked from rpms/libvirt 5 months ago
Clone
404507
From 1033a81438d6eae6eea225d489f876749f966f4d Mon Sep 17 00:00:00 2001
404507
Message-Id: <1033a81438d6eae6eea225d489f876749f966f4d@dist-git>
404507
From: Michal Privoznik <mprivozn@redhat.com>
404507
Date: Mon, 4 Dec 2017 13:38:49 +0100
404507
Subject: [PATCH] virDomainNumaGetNodeDistance: Fix input arguments validation
404507
404507
https://bugzilla.redhat.com/show_bug.cgi?id=1454889
404507
404507
There's no point in checking if numa->mem_nodes[node].ndistances
404507
is set if we check for numa->mem_nodes[node].distances. However,
404507
it makes sense to check if the sibling node (@cellid) caller
404507
passed falls within boundaries.
404507
404507
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
404507
Reviewed-by: John Ferlan <jferlan@redhat.com>
404507
(cherry picked from commit 0ededbb84eb34539e326b4d4791772b699352302)
404507
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
404507
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
404507
---
404507
 src/conf/numa_conf.c | 4 ++--
404507
 1 file changed, 2 insertions(+), 2 deletions(-)
404507
404507
diff --git a/src/conf/numa_conf.c b/src/conf/numa_conf.c
404507
index 7bba4120bd..c2f0d1ca8c 100644
404507
--- a/src/conf/numa_conf.c
404507
+++ b/src/conf/numa_conf.c
404507
@@ -1153,8 +1153,8 @@ virDomainNumaGetNodeDistance(virDomainNumaPtr numa,
404507
      * defined default for local and remote nodes.
404507
      */
404507
     if (!distances ||
404507
-        !distances[cellid].value ||
404507
-        !numa->mem_nodes[node].ndistances)
404507
+        cellid >= numa->nmem_nodes ||
404507
+        !distances[cellid].value)
404507
         return (node == cellid) ? LOCAL_DISTANCE : REMOTE_DISTANCE;
404507
 
404507
     return distances[cellid].value;
404507
-- 
404507
2.15.1
404507